summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vpp/app/vppctl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/vpp/app/vppctl.c b/src/vpp/app/vppctl.c
index 8fe493d3f2a..becab52d08b 100644
--- a/src/vpp/app/vppctl.c
+++ b/src/vpp/app/vppctl.c
@@ -215,6 +215,13 @@ main (int argc, char *argv[])
{
cmd_len++; // account for \n in the end
cmd = malloc (cmd_len);
+ if (!cmd)
+ {
+ error = errno;
+ perror ("malloc failed");
+ goto done;
+ }
+ memset (cmd, 0, cmd_len);
while (argc--)
{
strncat (cmd, *argv++, cmd_len);
@@ -431,6 +438,7 @@ main (int argc, char *argv[])
close (sock_fd);
done:
+ free (cmd);
if (efd > -1)
close (efd);