summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-12-20 03:12:32 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-12-20 03:26:47 +0000
commitc01d03a6587b18722e5a7381084591e01eca64b5 (patch)
tree2a55fb6589e8cbd63e266855d627d93731a62b48 /lib/command.c
parent96133092e02c7b07c9e4c6d3e26b871551fa0cef (diff)
bgpd, lib: fix a few scan-build catches
Fixes a couple null pointer derefs and uninit'd values. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/command.c b/lib/command.c
index ca0d0c001b..3cce4584e9 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -304,6 +304,9 @@ cmd_concat_strvec (vector v)
if (vector_slot (v, i))
strsize += strlen ((char *) vector_slot (v, i)) + 1;
+ if (strsize == 0)
+ return XSTRDUP (MTYPE_TMP, "");
+
char *concatenated = calloc (sizeof (char), strsize);
for (unsigned int i = 0; i < vector_active (v); i++)
{