From: Stéphane Graber Date: Tue, 18 Feb 2014 17:10:51 +0000 (-0500) Subject: coverity: Try to make it happier with our array handling X-Git-Tag: lxc-1.0.0.rc4~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10f98e9982136f66ef99ca877886cb44c2e77052;p=thirdparty%2Flxc.git coverity: Try to make it happier with our array handling Signed-off-by: Stéphane Graber --- diff --git a/src/lxc/lxc_attach.c b/src/lxc/lxc_attach.c index 33d5e9135..fc8e3ba5a 100644 --- a/src/lxc/lxc_attach.c +++ b/src/lxc/lxc_attach.c @@ -64,6 +64,8 @@ static int add_to_simple_array(char ***array, ssize_t *capacity, char *value) { ssize_t count = 0; + assert(array); + if (*array) for (; (*array)[count]; count++); @@ -78,8 +80,9 @@ static int add_to_simple_array(char ***array, ssize_t *capacity, char *value) *capacity = new_capacity; } - if (array) - (*array)[count] = value; + assert(*array); + + (*array)[count] = value; return 0; }