diff options
| author | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2019-10-14 23:29:19 -0300 |
|---|---|---|
| committer | Rafael Zalamena <rzalamena@opensourcerouting.org> | 2020-02-04 14:05:43 -0300 |
| commit | 54a35ff48b600cd59b715b6e5aea4e69de1b995f (patch) | |
| tree | 75bb1d0132d4d4e2f865529a3c49200c692c557b /lib/routemap.c | |
| parent | 91835f1fd2a8dd05a5ba03c8961b699aaabed7e7 (diff) | |
lib: fix route map northbound memory leak
Keep a list of hook contexts used by northbound so we don't lose the
pointer when free()ing the route map index entry data.
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
Diffstat (limited to 'lib/routemap.c')
| -rw-r--r-- | lib/routemap.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/routemap.c b/lib/routemap.c index 5369fa771f..912cf28202 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -909,6 +909,7 @@ static struct route_map_index *route_map_index_new(void) new = XCALLOC(MTYPE_ROUTE_MAP_INDEX, sizeof(struct route_map_index)); new->exitpolicy = RMAP_EXIT; /* Default to Cisco-style */ + TAILQ_INIT(&new->rhclist); QOBJ_REG(new, route_map_index); return new; } @@ -924,6 +925,10 @@ void route_map_index_delete(struct route_map_index *index, int notify) zlog_debug("Deleting route-map %s sequence %d", index->map->name, index->pref); + /* Free route map northbound hook contexts. */ + while (!TAILQ_EMPTY(&index->rhclist)) + routemap_hook_context_free(TAILQ_FIRST(&index->rhclist)); + /* Free route match. */ while ((rule = index->match_list.head) != NULL) route_map_rule_delete(&index->match_list, rule); |
