[lxc-devel] [PATCH 2/6] coverity: Silence potential null-deref warning

Stéphane Graber stgraber at ubuntu.com
Fri Feb 14 21:33:05 UTC 2014


Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 src/lxc/lxc_attach.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc_attach.c b/src/lxc/lxc_attach.c
index e3e89c4..33d5e91 100644
--- a/src/lxc/lxc_attach.c
+++ b/src/lxc/lxc_attach.c
@@ -78,7 +78,8 @@ static int add_to_simple_array(char ***array, ssize_t *capacity, char *value)
 		*capacity = new_capacity;
 	}
 
-	(*array)[count] = value;
+	if (array)
+		(*array)[count] = value;
 	return 0;
 }
 
-- 
1.9.rc1



More information about the lxc-devel mailing list