diff options
-rw-r--r-- | svm/svmtool.c | 1 | ||||
-rw-r--r-- | vlib-api/vlibapi/api_shared.c | 2 | ||||
-rw-r--r-- | vlib-api/vlibmemory/memory_vlib.c | 7 | ||||
-rw-r--r-- | vlib-api/vlibsocket/sockclnt_vlib.c | 1 | ||||
-rw-r--r-- | vlib-api/vlibsocket/socksvr_vlib.c | 1 | ||||
-rw-r--r-- | vlib/vlib/cli.c | 7 |
6 files changed, 16 insertions, 3 deletions
diff --git a/svm/svmtool.c b/svm/svmtool.c index c37afbd1..545f071e 100644 --- a/svm/svmtool.c +++ b/svm/svmtool.c @@ -164,6 +164,7 @@ svm_map_region_nolock (svm_map_region_args_t * a) if (rp->version == 0) { clib_warning ("rp->version %d not %d", rp->version, SVM_VERSION); + munmap (rp, MMAP_PAGESIZE); return (0); } /* Remap now that the region has been placed */ diff --git a/vlib-api/vlibapi/api_shared.c b/vlib-api/vlibapi/api_shared.c index 18b189e1..66f894b4 100644 --- a/vlib-api/vlibapi/api_shared.c +++ b/vlib-api/vlibapi/api_shared.c @@ -780,6 +780,7 @@ vl_msg_api_process_file (vlib_main_t * vm, u8 * filename, if (!(statb.st_mode & S_IFREG) || (statb.st_size < sizeof (*hp))) { vlib_cli_output (vm, "File not plausible: %s\n", filename); + close(fd); return; } @@ -814,6 +815,7 @@ vl_msg_api_process_file (vlib_main_t * vm, u8 * filename, { vlib_cli_output (vm, "Range (%d, %d) outside file range (0, %d)\n", first_index, last_index, nitems - 1); + munmap (hp, file_size); return; } if (hp->wrapped) diff --git a/vlib-api/vlibmemory/memory_vlib.c b/vlib-api/vlibmemory/memory_vlib.c index c2c14acf..13b1121a 100644 --- a/vlib-api/vlibmemory/memory_vlib.c +++ b/vlib-api/vlibmemory/memory_vlib.c @@ -1042,7 +1042,12 @@ vl_api_trace_print_file_cmd (vlib_main_t * vm, u32 first, u32 last, } msg_id = ntohs (msg_id); - fseek (fp, -2, SEEK_CUR); + if (fseek (fp, -2, SEEK_CUR) < 0) + { + vlib_cli_output (vm, "fseek failed, %s", strerror(errno)); + fclose(fp); + return; + } /* Mild sanity check */ if (msg_id >= vec_len (am->msg_handlers)) diff --git a/vlib-api/vlibsocket/sockclnt_vlib.c b/vlib-api/vlibsocket/sockclnt_vlib.c index d173c860..4ae274c2 100644 --- a/vlib-api/vlibsocket/sockclnt_vlib.c +++ b/vlib-api/vlibsocket/sockclnt_vlib.c @@ -114,6 +114,7 @@ sockclnt_open_index (char *client_name, char *hostname, int port) if (rv < 0) { clib_unix_warning ("FIONBIO"); + close(sockfd); return ~0; } diff --git a/vlib-api/vlibsocket/socksvr_vlib.c b/vlib-api/vlibsocket/socksvr_vlib.c index e70124d3..91c6bfde 100644 --- a/vlib-api/vlibsocket/socksvr_vlib.c +++ b/vlib-api/vlibsocket/socksvr_vlib.c @@ -608,6 +608,7 @@ socksvr_api_init (vlib_main_t * vm) rv = listen (sockfd, 5); if (rv < 0) { + close(sockfd); return clib_error_return_unix (0, "listen"); } diff --git a/vlib/vlib/cli.c b/vlib/vlib/cli.c index 79db99f9..5e959a78 100644 --- a/vlib/vlib/cli.c +++ b/vlib/vlib/cli.c @@ -853,8 +853,11 @@ add_sub_command (vlib_cli_main_t * cm, uword parent_index, uword child_index) q = hash_get_mem (cm->parse_rule_index_by_name, sub_name); if (!q) - clib_error ("reference to unknown rule `%%%v' in path `%v'", - sub_name, c->path); + { + clib_error ("reference to unknown rule `%%%v' in path `%v'", + sub_name, c->path); + return; + } hash_set_mem (p->sub_rule_index_by_name, sub_name, vec_len (p->sub_rules)); |