From: William Tu Date: Tue, 5 Jan 2016 21:38:42 +0000 (-0800) Subject: rstp: Fix memory leak reported by valgrind. X-Git-Tag: v2.5.0~88 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=2c255e23b98f1477046c7bdcc4b1da7033dcf9b5 rstp: Fix memory leak reported by valgrind. test case: 1650 RSTP Single bridge, call stacks hmap_insert_at (hmap.h:235) rstp_port_set_port_number__ (rstp.c:744) rstp_add_port (rstp.c:1164) new_bridge (test-rstp.c:123) test_rstp_main (test-rstp.c:514) ovstest_wrapper_test_rstp_main__ (test-rstp.c:714) ovs_cmdl_run_command (command-line.c:121) main (ovstest.c:132) fix it by adding hmap_destroy() at rstp_unref() Signed-off-by: William Tu Signed-off-by: Daniele Di Proietto Co-authored-by: Daniele Di Proietto Acked-by: Daniele Venturino Signed-off-by: Ben Pfaff --- diff --git a/lib/rstp.c b/lib/rstp.c index c1d5e7e3a..f1487cbae 100644 --- a/lib/rstp.c +++ b/lib/rstp.c @@ -185,6 +185,7 @@ rstp_unref(struct rstp *rstp) list_remove(&rstp->node); ovs_mutex_unlock(&rstp_mutex); + hmap_destroy(&rstp->ports); free(rstp->name); free(rstp); }