X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournal-remote-parse.c;fp=src%2Fjournal%2Fjournal-remote-parse.c;h=239ff381975703c920b0a9ad6d1e2348fe3905c6;hb=609211792b83267ca202b40f25d1755a004c8c96;hp=142de0ed1f004a56a25e83378c43f9ec58fc0413;hpb=b2103dccb354de3f38c49c14ccb637bdf665e40f;p=elogind.git diff --git a/src/journal/journal-remote-parse.c b/src/journal/journal-remote-parse.c index 142de0ed1..239ff3819 100644 --- a/src/journal/journal-remote-parse.c +++ b/src/journal/journal-remote-parse.c @@ -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); - c = memchr(source->buf, '\n', source->filled); + if (source->buf) + c = memchr(source->buf, '\n', source->filled); + if (c != NULL) goto docopy;