summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-04-05 21:05:22 +0200
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2014-04-06 11:55:20 +0200
commit609211792b83267ca202b40f25d1755a004c8c96 (patch)
tree643e7ac6c321a8b3bbb863a5ed66687f7b616cdb /src/journal
parentb2103dccb354de3f38c49c14ccb637bdf665e40f (diff)
journal-remote-parse: avoid passing null to memchr
Found with scan-build
Notes
Backport: bugfix
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/journal-remote-parse.c6
1 files changed, 4 insertions, 2 deletions
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;