From: Denil Vira Date: Thu, 23 Jul 2015 15:47:21 +0000 (-0700) Subject: Fix bugs reported by coverity scan X-Git-Tag: frr-2.0-rc1~1298 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=683de05f8708a43aabde961329b56b83cd856e31;p=matthieu%2Ffrr.git Fix bugs reported by coverity scan 1. Fix useless call in bgpd/bgp_mplsvpn.c Coverity scan ID : 1302528. Calling "decode_label(pnt)" is only useful for its return value, which is ignored. Removed the call. 2. Fix logically dead code in lib/stream.c Coverity Scan ID 1302488. Test for size==0 makes no sense, since assert immediately before it would not let this code happen. 3. Fix Free Pointer dereference in lib/filter.c Coverity Scan ID 23056. access is accessed after free in access_list_delete --- diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 81e0b94b3c..9a1d903350 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -139,8 +139,6 @@ bgp_nlri_parse_vpnv4 (struct peer *peer, struct attr *attr, return -1; } - (void)decode_label (pnt); - /* Copyr label to prefix. */ tagpnt = pnt;; diff --git a/lib/filter.c b/lib/filter.c index ae50e6cbe0..0eeb8f1872 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -496,13 +496,13 @@ access_list_filter_delete (struct access_list *access, struct filter *filter) filter_free (filter); route_map_notify_dependencies(access->name, RMAP_EVENT_FILTER_DELETED); - /* If access_list becomes empty delete it from access_master. */ - if (access_list_empty (access)) - access_list_delete (access); - /* Run hook function. */ if (master->delete_hook) (*master->delete_hook) (access); + + /* If access_list becomes empty delete it from access_master. */ + if (access_list_empty (access)) + access_list_delete (access); } /* diff --git a/lib/stream.c b/lib/stream.c index cc5898a6db..fcdf56f64f 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -93,12 +93,6 @@ stream_new (size_t size) assert (size > 0); - if (size == 0) - { - zlog_warn ("stream_new(): called with 0 size!"); - return NULL; - } - s = XCALLOC (MTYPE_STREAM, sizeof (struct stream)); if (s == NULL)