diff options
author | Chris Luke <chrisy@flirble.org> | 2017-09-07 07:40:13 -0400 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2017-09-08 02:17:27 +0000 |
commit | ab7b8d93cf1098970bc17fb4937376bb1ff33a21 (patch) | |
tree | b1c0c89e34cb87f6cd8c1f783654bf66c7b50ac9 /src/uri/vppcom.c | |
parent | 8a19f12a0cfe6d611f6e266931af691fb69a74ad (diff) |
Fixes for issues reported by Coverity (VPP-972)
Change-Id: I25238debb7081b4467aec4620dfdef33fbef3295
Signed-off-by: Chris Luke <chrisy@flirble.org>
Diffstat (limited to 'src/uri/vppcom.c')
-rw-r--r-- | src/uri/vppcom.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/uri/vppcom.c b/src/uri/vppcom.c index aec1295f1b3..aa307f1d333 100644 --- a/src/uri/vppcom.c +++ b/src/uri/vppcom.c @@ -1369,23 +1369,18 @@ vppcom_cfg_heapsize (char *conf_fname) argc++; char **tmp = realloc (argv, argc * sizeof (char *)); if (tmp == NULL) - { - fclose (fp); - goto defaulted; - } + goto defaulted; argv = tmp; arg = strndup (p, 1024); if (arg == NULL) - { - fclose (fp); - goto defaulted; - } + goto defaulted; argv[argc - 1] = arg; p = strtok (NULL, " \t\n"); } } fclose (fp); + fp = NULL; char **tmp = realloc (argv, (argc + 1) * sizeof (char *)); if (tmp == NULL) @@ -1438,6 +1433,10 @@ vppcom_cfg_heapsize (char *conf_fname) } defaulted: + if (fp != NULL) + fclose (fp); + if (argv != NULL) + free (argv); if (!clib_mem_init (0, vcl_cfg->heapsize)) clib_warning ("[%d] vppcom heap allocation failure!", vcm->my_pid); else if (VPPCOM_DEBUG > 0) @@ -1687,7 +1686,7 @@ input_done: unformat_free (input); file_done: - if (fd > 0) + if (fd >= 0) close (fd); } |