Skip to content

Commit

Permalink
lib: fix route map description memory leak
Browse files Browse the repository at this point in the history
Route map entries are not getting a chance to call `description` string
deallocation on shutdown or when the parent entry is destroyed, so lets
add a code to handle this in the `route_map_index_delete` function.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
  • Loading branch information
rzalamena committed Jul 6, 2020
1 parent 4267c07 commit f095133
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/routemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,9 @@ 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 entry description. */
XFREE(MTYPE_TMP, index->description);

/* Free route map northbound hook contexts. */
while ((rhc = TAILQ_FIRST(&index->rhclist)) != NULL)
routemap_hook_context_free(rhc);
Expand Down

0 comments on commit f095133

Please sign in to comment.