diff options
author | Mauro Sardara <msardara@cisco.com> | 2022-09-02 14:34:36 +0000 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2022-09-02 14:42:53 +0000 |
commit | cb6f5724b85e51295498a39144ed4ccce114ad53 (patch) | |
tree | 090b6753d305fd7bc25b84879b63581bbec3b38c /hicn-plugin/src/test | |
parent | 00a6f92b97a0456259163ade2085defdebeb3f84 (diff) |
fix(sonar): make sonarqube happy
Ref: HICN-766 HICN-767 HICN-764 HICN-762 HICN-743 HICN-759 HICN-760 HICN-758 HICN-761 HICN-756
Change-Id: Ic2accf6b6771c7a78d2b22d9bdb8e5a5be9ead8a
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'hicn-plugin/src/test')
-rw-r--r-- | hicn-plugin/src/test/vpp.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/hicn-plugin/src/test/vpp.c b/hicn-plugin/src/test/vpp.c index fc96e6e16..761e55759 100644 --- a/hicn-plugin/src/test/vpp.c +++ b/hicn-plugin/src/test/vpp.c @@ -190,11 +190,17 @@ vpp_init_internal (int argc, char *argv[]) argc_++; char **tmp = realloc (argv_, argc_ * sizeof (char *)); if (tmp == NULL) - return 1; + { + fclose (fp); + return 1; + } argv_ = tmp; arg = strndup (p, 1024); if (arg == NULL) - return 1; + { + free (argv_); + return 1; + } argv_[argc_ - 1] = arg; p = strtok (NULL, " \t\n"); } @@ -204,7 +210,10 @@ vpp_init_internal (int argc, char *argv[]) char **tmp = realloc (argv_, (argc_ + 1) * sizeof (char *)); if (tmp == NULL) - return 1; + { + free (argv_); + return 1; + } argv_ = tmp; argv_[argc_] = NULL; @@ -540,6 +549,11 @@ vpp_init () ASSERT (ret < BUFFER_LEN); + if (ret >= BUFFER_LEN) + { + return -1; + } + buffer[ret] = '\0'; char *argv[N_ARGS] = { buffer, "unix { nodaemon }", NULL }; |