diff options
author | Steven <sluong@cisco.com> | 2017-11-30 16:56:54 -0800 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-12-01 11:14:52 +0000 |
commit | f953dfc8e01426ce93588e9013c112e48a9a8463 (patch) | |
tree | dd5e7eb09511df669dc9bec6a1cbf0300df3c344 /src/vat/api_format.c | |
parent | 088f0e221c05b7b1cd59b61442eaf595e22e2fef (diff) |
virtio: fix coverity warnings
Fix 3 coverity warnings
1. api_format.c: init net_ns = 0 and remove its corresponding vec_add and
vec_free
2. netlink.c (reported in tap.c before the code was removed): resource leaked
due to fd is not close
3. tap.c: subtract 1 for size when calling strncpy to accommodate the
terminated NULL character
Change-Id: Iff4e66604862f0c06dac227b8cfd48d3979e41a5
Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'src/vat/api_format.c')
-rw-r--r-- | src/vat/api_format.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c index 2a56423265e..c9c62c76e2c 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -7812,7 +7812,7 @@ api_tap_create_v2 (vat_main_t * vam) u8 random_mac = 1; u8 name_set = 0; u8 *tap_name; - u8 *net_ns; + u8 *net_ns = 0; u8 net_ns_set = 0; int ret; int rx_ring_sz = 0, tx_ring_sz = 0; @@ -7875,7 +7875,6 @@ api_tap_create_v2 (vat_main_t * vam) } vec_add1 (tap_name, 0); - vec_add1 (net_ns, 0); /* Construct the API message */ M (TAP_CREATE_V2, mp); @@ -7890,7 +7889,6 @@ api_tap_create_v2 (vat_main_t * vam) clib_memcpy (mp->net_ns, net_ns, vec_len (net_ns)); vec_free (tap_name); - vec_free (net_ns); /* send it... */ S (mp); |