]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: fix route map description memory leak
authorRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 6 Jul 2020 14:39:27 +0000 (11:39 -0300)
committerRafael Zalamena <rzalamena@opensourcerouting.org>
Mon, 6 Jul 2020 17:40:59 +0000 (14:40 -0300)
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>
(cherry picked from commit f0951335830203426074ddca4317f84b477e4afb)

lib/routemap.c

index 3d69a3495a27b923812c2e2cc4e9ba54720a87b2..3b451334506c0f5da7919d9742245383e3a94773 100644 (file)
@@ -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);