From 577a81141ffc2e31e1e84b9f5de38bcb536b2cce Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 16 Apr 2015 14:46:27 -0700 Subject: [PATCH] ovs-lldp: Avoid use-after-free in aa_mapping_unregister(). Found by LLVM scan-build. Reported-by: Kevin Lo Signed-off-by: Ben Pfaff Acked-by: Dennis Flynn --- lib/ovs-lldp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ovs-lldp.c b/lib/ovs-lldp.c index 61534a4bf..db213b45f 100644 --- a/lib/ovs-lldp.c +++ b/lib/ovs-lldp.c @@ -619,7 +619,6 @@ aa_mapping_unregister(void *aux) } hmap_remove(&lldp->mappings_by_aux, &m->hmap_node_aux); - free(m); /* Remove from all the lldp instances */ LIST_FOR_EACH (hw, h_entries, &lldp->lldpd->g_hardware) { @@ -629,6 +628,7 @@ aa_mapping_unregister(void *aux) aa_mapping_unregister_mapping(lldp, hw, m); } + free(m); /* Remove from the all_mappings */ HMAP_FOR_EACH (m, hmap_node_isid, all_mappings) { -- 2.20.1