From a556f6e38b404ae1b90a52b23e5afacd64ab4d45 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 30 Aug 2024 08:52:06 -0400 Subject: [PATCH 1/2] isisd: in isis_mt.c use appropriate memory allocator Signed-off-by: Donald Sharp --- isisd/isis_mt.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/isisd/isis_mt.c b/isisd/isis_mt.c index d04a24dc4683..65ba395ffc81 100644 --- a/isisd/isis_mt.c +++ b/isisd/isis_mt.c @@ -226,7 +226,8 @@ struct isis_area_mt_setting **area_mt_settings(struct isis_area *area, count++; if (count > size) { - rv = XREALLOC(MTYPE_TMP, rv, count * sizeof(*rv)); + rv = XREALLOC(MTYPE_MT_AREA_SETTING, rv, + count * sizeof(*rv)); size = count; } rv[count - 1] = setting; @@ -341,7 +342,8 @@ circuit_mt_settings(struct isis_circuit *circuit, unsigned int *mt_count) count++; if (count > size) { - rv = XREALLOC(MTYPE_TMP, rv, count * sizeof(*rv)); + rv = XREALLOC(MTYPE_MT_AREA_SETTING, rv, + count * sizeof(*rv)); size = count; } rv[count - 1] = setting; @@ -376,8 +378,8 @@ bool tlvs_to_adj_mt_set(struct isis_tlvs *tlvs, bool v4_usable, bool v6_usable, old_mt_count = adj->mt_count; if (old_mt_count) { - old_mt_set = - XCALLOC(MTYPE_TMP, old_mt_count * sizeof(*old_mt_set)); + old_mt_set = XCALLOC(MTYPE_MT_AREA_SETTING, + old_mt_count * sizeof(*old_mt_set)); memcpy(old_mt_set, adj->mt_set, old_mt_count * sizeof(*old_mt_set)); } @@ -436,7 +438,7 @@ bool tlvs_to_adj_mt_set(struct isis_tlvs *tlvs, bool v4_usable, bool v6_usable, changed = true; if (old_mt_count) - XFREE(MTYPE_TMP, old_mt_set); + XFREE(MTYPE_MT_AREA_SETTING, old_mt_set); return changed; } @@ -464,7 +466,7 @@ static void mt_set_add(uint16_t **mt_set, unsigned int *size, } if (*index >= *size) { - *mt_set = XREALLOC(MTYPE_TMP, *mt_set, + *mt_set = XREALLOC(MTYPE_MT_AREA_SETTING, *mt_set, sizeof(**mt_set) * ((*index) + 1)); *size = (*index) + 1; } From d97c535c1e11904585b97da894d49b766b2d270a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 30 Aug 2024 09:05:11 -0400 Subject: [PATCH 2/2] *: Create termtable specific temp memory When trying to track down a MTYPE_TMP memory leak it's harder to search for it when you happen to have some usage of ttable_dump. Let's just give it it's own memory type so that we can avoid confusion in the future. Signed-off-by: Donald Sharp --- bgpd/bgp_bmp.c | 4 ++-- isisd/isis_spf.c | 6 +++--- isisd/isis_sr.c | 2 +- isisd/isis_srv6.c | 2 +- lib/hash.c | 2 +- lib/memory.c | 1 + lib/memory.h | 1 + lib/northbound_cli.c | 6 +++--- lib/termtable.c | 2 +- lib/termtable.h | 2 +- pathd/path_cli.c | 2 +- pimd/pim6_mld.c | 4 ++-- pimd/pim_cmd_common.c | 36 ++++++++++++++++++------------------ pimd/pim_rp.c | 2 +- tests/lib/test_ttable.c | 36 ++++++++++++++++++------------------ vrrpd/vrrp_vty.c | 4 ++-- zebra/dplane_fpm_nl.c | 2 +- zebra/zebra_mpls.c | 2 +- zebra/zebra_vty.c | 2 +- 19 files changed, 60 insertions(+), 58 deletions(-) diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index 675e4765e406..44a4c0f00be3 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -2743,7 +2743,7 @@ DEFPY(show_bmp, } out = ttable_dump(tt, "\n"); vty_out(vty, "%s", out); - XFREE(MTYPE_TMP, out); + XFREE(MTYPE_TMP_TTABLE, out); ttable_del(tt); vty_out(vty, "\n %zu connected clients:\n", @@ -2770,7 +2770,7 @@ DEFPY(show_bmp, } out = ttable_dump(tt, "\n"); vty_out(vty, "%s", out); - XFREE(MTYPE_TMP, out); + XFREE(MTYPE_TMP_TTABLE, out); ttable_del(tt); vty_out(vty, "\n"); } diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 86302076f82d..0f37ed012a6e 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -2337,7 +2337,7 @@ static void isis_print_paths(struct vty *vty, struct isis_vertex_queue *queue, if (json == NULL) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); } else *json = ttable_json_with_json_text( tt, "ssdsss", @@ -3016,7 +3016,7 @@ void isis_print_routes(struct vty *vty, struct isis_spftree *spftree, table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); } else if (json) { *json = ttable_json_with_json_text( tt, prefix_sid ? "sdssdsdd" : "sdsss", @@ -3458,7 +3458,7 @@ static void isis_print_frr_summary(struct vty *vty, /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index f7830380064e..71e0f56e0348 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -1064,7 +1064,7 @@ static void show_node(struct vty *vty, struct isis_area *area, int level, table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); } ttable_del(tt); } diff --git a/isisd/isis_srv6.c b/isisd/isis_srv6.c index b5974b1a6276..2348bd043a65 100644 --- a/isisd/isis_srv6.c +++ b/isisd/isis_srv6.c @@ -591,7 +591,7 @@ static void show_node(struct vty *vty, struct isis_area *area, int level) table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); } ttable_del(tt); } diff --git a/lib/hash.c b/lib/hash.c index df5624398533..edbfeec4645e 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -444,7 +444,7 @@ DEFUN_NOSH(show_hash_stats, ttable_colseps(tt, 0, RIGHT, true, '|'); char *table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); } else vty_out(vty, "No named hash tables to display.\n"); diff --git a/lib/memory.c b/lib/memory.c index 8fbe5c409366..ac39516edd75 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -25,6 +25,7 @@ struct memgroup **mg_insert = &mg_first; DEFINE_MGROUP(LIB, "libfrr"); DEFINE_MTYPE(LIB, TMP, "Temporary memory"); +DEFINE_MTYPE(LIB, TMP_TTABLE, "Temporary memory for TTABLE"); DEFINE_MTYPE(LIB, BITFIELD, "Bitfield memory"); static inline void mt_count_alloc(struct memtype *mt, size_t size, void *ptr) diff --git a/lib/memory.h b/lib/memory.h index 65b99a5fc945..8e8c61da04d0 100644 --- a/lib/memory.h +++ b/lib/memory.h @@ -138,6 +138,7 @@ struct memgroup { DECLARE_MGROUP(LIB); DECLARE_MTYPE(TMP); +DECLARE_MTYPE(TMP_TTABLE); extern void *qmalloc(struct memtype *mt, size_t size) diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index f70bae9ed28c..f9794bee3c74 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -1386,7 +1386,7 @@ static int nb_cli_show_transactions(struct vty *vty) table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); } else vty_out(vty, "No configuration transactions to display.\n\n"); @@ -1667,7 +1667,7 @@ DEFPY (show_yang_module, table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); } else vty_out(vty, "No YANG modules to display.\n\n"); @@ -1777,7 +1777,7 @@ DEFPY (show_yang_module_translator, table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); } else vty_out(vty, "No YANG module translators to display.\n\n"); diff --git a/lib/termtable.c b/lib/termtable.c index 88cc25bf68c5..ce197013897c 100644 --- a/lib/termtable.c +++ b/lib/termtable.c @@ -363,7 +363,7 @@ char *ttable_dump(struct ttable *tt, const char *newline) memcpy(&right[0], newline, nl_len); /* allocate print buffer */ - buf = XCALLOC(MTYPE_TMP, width * (nlines + 1) + 1); + buf = XCALLOC(MTYPE_TMP_TTABLE, width * (nlines + 1) + 1); pos = 0; if (tt->style.border.top_on) { diff --git a/lib/termtable.h b/lib/termtable.h index 0782c82abdfd..d284c4f3764a 100644 --- a/lib/termtable.h +++ b/lib/termtable.h @@ -270,7 +270,7 @@ void ttable_rowseps(struct ttable *tt, unsigned int row, * * Caller must free this string after use with * - * XFREE (MTYPE_TMP, str); + * XFREE (MTYPE_TMP_TTABLE, str); * * @param tt the table to dump * @param newline the desired newline sequence to use, null terminated. diff --git a/pathd/path_cli.c b/pathd/path_cli.c index 436883c1fd82..bf8a9ea02841 100644 --- a/pathd/path_cli.c +++ b/pathd/path_cli.c @@ -131,7 +131,7 @@ DEFPY(show_srte_policy, /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c index a39d182990bf..8ccf42d729ba 100644 --- a/pimd/pim6_mld.c +++ b/pimd/pim6_mld.c @@ -2537,7 +2537,7 @@ static void gm_show_if_vrf(struct vty *vty, struct vrf *vrf, const char *ifname, if (!js && !detail) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -3021,7 +3021,7 @@ static void gm_show_groups(struct vty *vty, struct vrf *vrf, bool uj) /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index d1368ff1ffe4..a87f5b698184 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -874,7 +874,7 @@ void pim_show_rpf(struct pim_instance *pim, struct vty *vty, json_object *json) if (!json) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -926,7 +926,7 @@ void pim_show_neighbors_secondary(struct pim_instance *pim, struct vty *vty) /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } @@ -1180,7 +1180,7 @@ void pim_show_state(struct pim_instance *pim, struct vty *vty, #else table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); #endif } @@ -1413,7 +1413,7 @@ void pim_show_upstream(struct pim_instance *pim, struct vty *vty, if (!json) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -1490,7 +1490,7 @@ void pim_show_join_desired(struct pim_instance *pim, struct vty *vty, bool uj) /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -1569,7 +1569,7 @@ void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, bool uj) /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -1751,7 +1751,7 @@ void pim_show_join(struct pim_instance *pim, struct vty *vty, pim_sgaddr *sg, if (!json) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -1831,7 +1831,7 @@ void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty) /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } @@ -1974,7 +1974,7 @@ void pim_show_membership(struct pim_instance *pim, struct vty *vty, bool uj) /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -2079,7 +2079,7 @@ void pim_show_channel(struct pim_instance *pim, struct vty *vty, bool uj) /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -2262,7 +2262,7 @@ void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag, /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } @@ -2734,7 +2734,7 @@ static int pim_print_vty_pnc_cache_walkcb(struct hash_bucket *bucket, void *arg) /* Dump the generated table. */ table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); return CMD_SUCCESS; @@ -3214,7 +3214,7 @@ void pim_show_neighbors(struct pim_instance *pim, struct vty *vty, if (!json) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -3500,7 +3500,7 @@ void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty, if (!json) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -3939,7 +3939,7 @@ void show_mroute(struct pim_instance *pim, struct vty *vty, pim_sgaddr *sg, if (!json) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -4022,7 +4022,7 @@ void show_mroute_count(struct pim_instance *pim, struct vty *vty, if (!json) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } } @@ -5325,7 +5325,7 @@ static void pim_show_group_rp_mappings_info(struct pim_instance *pim, table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); tt = NULL; } @@ -5379,7 +5379,7 @@ static void pim_show_group_rp_mappings_info(struct pim_instance *pim, table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } if (!bsm_rpinfos_count(bsgrp->partial_bsrp_list) && !uj) diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 0f8940bb16d7..a2ddc82164a2 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -1272,7 +1272,7 @@ void pim_rp_show_information(struct pim_instance *pim, struct prefix *range, if (!json) { table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } else { if (prev_rp_info && json_rp_rows) diff --git a/tests/lib/test_ttable.c b/tests/lib/test_ttable.c index 562ddf9d66e3..7ac0e3516b0b 100644 --- a/tests/lib/test_ttable.c +++ b/tests/lib/test_ttable.c @@ -20,7 +20,7 @@ int main(int argc, char **argv) assert(tt->nrows == 1); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* add new row with 1 column, assert that it is not added */ assert(ttable_add_row(tt, "%s", "Garbage") == NULL); @@ -28,7 +28,7 @@ int main(int argc, char **argv) assert(tt->nrows == 1); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* add new row, assert that it is added */ assert(ttable_add_row(tt, "%s|%s|%s", "a", "b", "c")); @@ -36,7 +36,7 @@ int main(int argc, char **argv) assert(tt->nrows == 2); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* add empty row, assert that it is added */ assert(ttable_add_row(tt, "||")); @@ -44,7 +44,7 @@ int main(int argc, char **argv) assert(tt->nrows == 3); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* delete 1st row, assert that it is removed */ ttable_del_row(tt, 0); @@ -52,7 +52,7 @@ int main(int argc, char **argv) assert(tt->nrows == 2); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* delete last row, assert that it is removed */ ttable_del_row(tt, 0); @@ -60,7 +60,7 @@ int main(int argc, char **argv) assert(tt->nrows == 1); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* delete the remaining row, check dumping an empty table */ ttable_del_row(tt, 0); @@ -68,7 +68,7 @@ int main(int argc, char **argv) assert(tt->nrows == 0); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* add new row */ ttable_add_row(tt, "%s|%s||%s|%9d", "slick", "black", "triple", 1337); @@ -76,7 +76,7 @@ int main(int argc, char **argv) assert(tt->nrows == 1); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* add bigger row */ ttable_add_row(tt, "%s|%s||%s|%s", @@ -86,7 +86,7 @@ int main(int argc, char **argv) assert(tt->nrows == 2); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* insert new row at beginning */ ttable_insert_row(tt, 0, "%s|%s||%d|%lf", "converting", "vegetarians", @@ -95,7 +95,7 @@ int main(int argc, char **argv) assert(tt->nrows == 3); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* insert new row at end */ ttable_insert_row(tt, tt->nrows - 1, "%s|%s||%d|%ld", "converting", @@ -104,7 +104,7 @@ int main(int argc, char **argv) assert(tt->nrows == 4); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* insert new row at middle */ ttable_insert_row(tt, 1, "%s|%s||%s|%ld", "she", "pioneer", "aki", 1l); @@ -112,7 +112,7 @@ int main(int argc, char **argv) assert(tt->nrows == 5); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* set alignment */ ttable_align(tt, 0, 1, 2, 2, LEFT); @@ -120,14 +120,14 @@ int main(int argc, char **argv) assert(tt->nrows == 5); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_align(tt, 0, 1, 5, 1, RIGHT); assert(tt->ncols == 5); assert(tt->nrows == 5); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* set padding */ ttable_pad(tt, 0, 1, 1, 1, RIGHT, 2); @@ -135,14 +135,14 @@ int main(int argc, char **argv) assert(tt->nrows == 5); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_pad(tt, 0, 0, 5, 4, LEFT, 2); assert(tt->ncols == 5); assert(tt->nrows == 5); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* restyle */ tt->style.cell.border.bottom_on = false; @@ -156,13 +156,13 @@ int main(int argc, char **argv) ttable_rowseps(tt, 1, TOP, true, '-'); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* column separators for leftmost column */ ttable_colseps(tt, 0, RIGHT, true, '|'); table = ttable_dump(tt, "\n"); fprintf(stdout, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); /* delete table */ ttable_del(tt); diff --git a/vrrpd/vrrp_vty.c b/vrrpd/vrrp_vty.c index 985354af370a..59794d929787 100644 --- a/vrrpd/vrrp_vty.c +++ b/vrrpd/vrrp_vty.c @@ -590,7 +590,7 @@ static void vrrp_show(struct vty *vty, struct vrrp_vrouter *vr) char *table = ttable_dump(tt, "\n"); vty_out(vty, "\n%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); } @@ -695,7 +695,7 @@ DEFPY_YANG(vrrp_vrid_show_summary, char *table = ttable_dump(tt, "\n"); vty_out(vty, "\n%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); ttable_del(tt); list_delete(&ll); diff --git a/zebra/dplane_fpm_nl.c b/zebra/dplane_fpm_nl.c index 09080aa6164d..eb968bcd372a 100644 --- a/zebra/dplane_fpm_nl.c +++ b/zebra/dplane_fpm_nl.c @@ -381,7 +381,7 @@ DEFPY(fpm_show_status, out = ttable_dump(table, "\n"); vty_out(vty, "%s\n", out); - XFREE(MTYPE_TMP, out); + XFREE(MTYPE_TMP_TTABLE, out); ttable_del(table); } diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index d1c9cd54affc..086150fb04c9 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -3794,7 +3794,7 @@ void zebra_mpls_print_lsp_table(struct vty *vty, struct zebra_vrf *zvrf, if (tt->nrows > 1) { char *table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); - XFREE(MTYPE_TMP, table); + XFREE(MTYPE_TMP_TTABLE, table); } ttable_del(tt); } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 0459781efd4b..501e9d526834 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -3917,7 +3917,7 @@ DEFUN (show_zebra, out = ttable_dump(table, "\n"); vty_out(vty, "%s\n", out); - XFREE(MTYPE_TMP, out); + XFREE(MTYPE_TMP_TTABLE, out); ttable_del(table); vty_out(vty,