[systemd-commits] src/journal
Thomas H.P. Andersen
phomes at kemper.freedesktop.org
Sun Apr 6 02:55:29 PDT 2014
src/journal/journal-remote-parse.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
New commits:
commit 609211792b83267ca202b40f25d1755a004c8c96
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date: Sat Apr 5 21:05:22 2014 +0200
journal-remote-parse: avoid passing null to memchr
Found with scan-build
diff --git a/src/journal/journal-remote-parse.c b/src/journal/journal-remote-parse.c
index 142de0e..239ff38 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;
More information about the systemd-commits
mailing list