summaryrefslogtreecommitdiffstats
path: root/src/uri/vppcom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/uri/vppcom.c')
-rw-r--r--src/uri/vppcom.c17
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);
}