mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
journal-remote-parse: avoid passing null to memchr
Found with scan-build
This commit is contained in:
parent
b2103dccb3
commit
609211792b
Notes:
Lennart Poettering
2014-05-24 11:30:40 +08:00
Backport: bugfix
@ -40,7 +40,7 @@ void source_free(RemoteSource *source) {
|
||||
|
||||
static int get_line(RemoteSource *source, char **line, size_t *size) {
|
||||
ssize_t n, remain;
|
||||
char *c;
|
||||
char *c = NULL;
|
||||
char *newbuf = NULL;
|
||||
size_t newsize = 0;
|
||||
|
||||
@ -49,7 +49,9 @@ static int get_line(RemoteSource *source, char **line, size_t *size) {
|
||||
assert(source->filled <= source->size);
|
||||
assert(source->buf == NULL || source->size > 0);
|
||||
|
||||
if (source->buf)
|
||||
c = memchr(source->buf, '\n', source->filled);
|
||||
|
||||
if (c != NULL)
|
||||
goto docopy;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user