]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: Try to make it happier with our array handling
authorStéphane Graber <stgraber@ubuntu.com>
Tue, 18 Feb 2014 17:10:51 +0000 (12:10 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 18 Feb 2014 17:10:51 +0000 (12:10 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxc_attach.c

index 33d5e9135991326abfa26ea951e6ca42767d1228..fc8e3ba5a7e7420926d10bdeedb06beb81c2eebd 100644 (file)
@@ -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;
 }