Skip to content

Commit

Permalink
Coverity issues in contrail-controller/multicast/grpmgmt
Browse files Browse the repository at this point in the history
I have run Coverity on branch R5.0 and it reported the
following issues in contrail-controller/multicast/grpmgmt:

- leaked_storage: Variable cat_entry going out of scope leaks
the storage it points to in
gmp_addrlist.c:gmp_lookup_create_addr_cat_entry()
Indeed, cat_entry should be freed if the following condition is matched:
if (cat_entry->adcat_ent_ord == ORD_BAD_ORDINAL)

- leaked_storage: Variable addr_thread going out of scope leaks
the storage it points to in
igmp_protocol.c:igmp_parse_v3_report_packet()
Indeed, addr_thread should be freed if the following condition is matched:
if (gmp_enqueue_addr_thread_addr(addr_thread, addr_ptr, IPV4_ADDR_LEN) < 0)

Change-Id: I04cf563b5b831bf72b11cba7a2df0d9d23da56ec
Closes-Bug: #1770578
Signed-off-by: Anda Nicolae <anicolae@lenovo.com>
  • Loading branch information
Anda Nicolae committed May 11, 2018
1 parent 35f6485 commit 175b719
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/vnsw/agent/services/multicast/grpmgmt/gmp_addrlist.c
Expand Up @@ -490,8 +490,10 @@ gmp_lookup_create_addr_cat_entry (gmp_addr_catalog *catalog,
memmove(cat_entry->adcat_ent_addr.gmp_addr, addr,
catalog->adcat_addrlen);
cat_entry->adcat_ent_ord = ord_get_ordinal(catalog->adcat_ord_handle);
if (cat_entry->adcat_ent_ord == ORD_BAD_ORDINAL)
if (cat_entry->adcat_ent_ord == ORD_BAD_ORDINAL) {
free(cat_entry);
return ORD_BAD_ORDINAL; /* Out of memory */
}

/* Add it to the patricia trees. */

Expand Down
4 changes: 3 additions & 1 deletion src/vnsw/agent/services/multicast/grpmgmt/igmp_protocol.c
Expand Up @@ -1327,8 +1327,10 @@ igmp_parse_v3_report_packet(igmp_packet *packet, gmp_packet *gen_packet,
/* Enqueue an address thread entry for the next address. */

if (gmp_enqueue_addr_thread_addr(addr_thread, addr_ptr,
IPV4_ADDR_LEN) < 0)
IPV4_ADDR_LEN) < 0) {
free(addr_thread);
return FALSE; /* Out of memory */
}
addr_ptr += IPV4_ADDR_LEN;
}
group_rcrd->gmp_rpt_rcv_srcs = addr_thread;
Expand Down

0 comments on commit 175b719

Please sign in to comment.