You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.1 KiB

  1. From cc45875e0d2af0b53100ec78364dc51b39a12ac9 Mon Sep 17 00:00:00 2001
  2. From: Rafael Zalamena <rzalamena@opensourcerouting.org>
  3. Date: Mon, 6 Jul 2020 11:39:27 -0300
  4. Subject: [PATCH] lib: fix route map description memory leak
  5. Route map entries are not getting a chance to call `description` string
  6. deallocation on shutdown or when the parent entry is destroyed, so lets
  7. add a code to handle this in the `route_map_index_delete` function.
  8. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
  9. (cherry picked from commit f0951335830203426074ddca4317f84b477e4afb)
  10. ---
  11. lib/routemap.c | 3 +++
  12. 1 file changed, 3 insertions(+)
  13. diff --git a/lib/routemap.c b/lib/routemap.c
  14. index 3d69a3495a..3b45133450 100644
  15. --- a/lib/routemap.c
  16. +++ b/lib/routemap.c
  17. @@ -971,6 +971,9 @@ void route_map_index_delete(struct route_map_index *index, int notify)
  18. zlog_debug("Deleting route-map %s sequence %d",
  19. index->map->name, index->pref);
  20. + /* Free route map entry description. */
  21. + XFREE(MTYPE_TMP, index->description);
  22. +
  23. /* Free route map northbound hook contexts. */
  24. while ((rhc = TAILQ_FIRST(&index->rhclist)) != NULL)
  25. routemap_hook_context_free(rhc);