From c01d03a6587b18722e5a7381084591e01eca64b5 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 20 Dec 2016 03:12:32 +0000 Subject: bgpd, lib: fix a few scan-build catches Fixes a couple null pointer derefs and uninit'd values. Signed-off-by: Quentin Young --- lib/command.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/command.c') 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++) { -- cgit v1.2.3