]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: fix zebra router memleaks
authorQuentin Young <qlyoung@cumulusnetworks.com>
Sun, 28 Oct 2018 10:54:52 +0000 (10:54 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Sun, 28 Oct 2018 10:54:52 +0000 (10:54 +0000)
* Correctly set safi to prevent duplicate allocations
* Free previously allocated table->info before overwriting it

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
zebra/zebra_router.c
zebra/zebra_vrf.c

index 99d96fd67f44e75c152a143f2aeb70107fd3d8e7..afe3c708a012fa3ce20399c9cf008465908e2886 100644 (file)
@@ -96,6 +96,7 @@ struct route_table *zebra_router_get_table(struct zebra_vrf *zvrf,
        zrt = XCALLOC(MTYPE_ZEBRA_NS, sizeof(*zrt));
        zrt->tableid = tableid;
        zrt->afi = afi;
+       zrt->safi = safi;
        zrt->ns_id = zvrf->zns->ns_id;
        zrt->table =
                (afi == AFI_IP6) ? srcdest_table_init() : route_table_init();
index e98a5336097f88c0532cff13736a02ddfe0ccfdb..38b8b43d73f45dfb0db3f01afc55994cd409cd76 100644 (file)
@@ -380,6 +380,7 @@ static void zebra_vrf_table_create(struct zebra_vrf *zvrf, afi_t afi,
        table->cleanup = zebra_rtable_node_cleanup;
        zvrf->table[afi][safi] = table;
 
+       XFREE(MTYPE_RIB_TABLE_INFO, table->info);
        info = XCALLOC(MTYPE_RIB_TABLE_INFO, sizeof(*info));
        info->zvrf = zvrf;
        info->afi = afi;