summaryrefslogtreecommitdiff
path: root/libdaemon
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-02-26 10:15:24 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2016-02-26 10:21:36 +0100
commit2988fa3c21cf84071446bc11cb61d5b8507c088c (patch)
treea78a5481529725059a475c12b242993bd2dc5568 /libdaemon
parent85a593c1911f5c7ef5a8de38178b085c02ad3965 (diff)
downloadlvm2-2988fa3c21cf84071446bc11cb61d5b8507c088c.tar.gz
coverity: helping coverity with NULL pointer
Helping with understanding we will not try to deref NULL pointer, as if the sizes are initialized to NULL it also means 'mem' would be NULL, but thats too hard to model so make it obvious.
Diffstat (limited to 'libdaemon')
-rw-r--r--libdaemon/client/config-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libdaemon/client/config-util.c b/libdaemon/client/config-util.c
index 7a7dfed9d..e262182b6 100644
--- a/libdaemon/client/config-util.c
+++ b/libdaemon/client/config-util.c
@@ -366,9 +366,9 @@ int buffer_append(struct buffer *buf, const char *string)
{
int len = strlen(string);
- if ((buf->allocated - buf->used <= len) &&
+ if ((!buf->mem || (buf->allocated - buf->used <= len)) &&
!buffer_realloc(buf, len + 1))
- return 0;
+ return 0;
strcpy(buf->mem + buf->used, string);
buf->used += len;