summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_aspath.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-09-03 20:26:36 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-09-03 20:26:36 +0200
commit4390a8eee79f19bc2923d229df2a8cfbf9ba5d5e (patch)
tree02e36a8b23a5bc3895614a4c8ea5ba8264d3c016 /bgpd/bgp_aspath.c
parentMerge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga in... (diff)
downloadfrr-4390a8eee79f19bc2923d229df2a8cfbf9ba5d5e.tar.xz
frr-4390a8eee79f19bc2923d229df2a8cfbf9ba5d5e.zip
Bgpd: aspath json memory leak fix
Ticket: CM-6790 Reviewed by: CCR-3453 Testing: See bug This code change fixes these things: (a) Fixes an assert followed by an if statement (B) Fixes the memory leak in aspath->json
Diffstat (limited to 'bgpd/bgp_aspath.c')
-rw-r--r--bgpd/bgp_aspath.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index a270d8cd7..c9a6f3fd9 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -710,8 +710,6 @@ aspath_hash_alloc (void *arg)
/* Malformed AS path value. */
assert (aspath->str);
- if (! aspath->str)
- return NULL;
/* New aspath structure is needed. */
new = XMALLOC (MTYPE_AS_PATH, sizeof (struct aspath));
@@ -860,6 +858,11 @@ aspath_parse (struct stream *s, size_t length, int use32bit)
assegment_free_all (as.segments);
/* aspath_key_make() always updates the string */
XFREE (MTYPE_AS_STR, as.str);
+ if (as.json)
+ {
+ json_object_free(as.json);
+ as.json = NULL;
+ }
}
find->refcnt++;