From ee45ad81ab7e9ff6034352b6743985e28fedd649 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 13 Dec 2010 13:08:31 -0800 Subject: [PATCH] ovs-vswitchd: Release most memory on normal exit. This makes "valgrind --leak-check=full --show-reachable=yes" output much easier to read. --- vswitchd/bridge.c | 11 +++++++++++ vswitchd/bridge.h | 7 ++----- vswitchd/ovs-vswitchd.c | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 18e4ef240..f739505e3 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -317,6 +317,17 @@ bridge_init(const char *remote) bond_init(); } +void +bridge_exit(void) +{ + struct bridge *br, *next_br; + + LIST_FOR_EACH_SAFE (br, next_br, node, &all_bridges) { + bridge_destroy(br); + } + ovsdb_idl_destroy(idl); +} + /* Performs configuration that is only necessary once at ovs-vswitchd startup, * but for which the ovs-vswitchd configuration 'cfg' is required. */ static void diff --git a/vswitchd/bridge.h b/vswitchd/bridge.h index 42ba4e5cc..32b581e2d 100644 --- a/vswitchd/bridge.h +++ b/vswitchd/bridge.h @@ -16,12 +16,9 @@ #ifndef VSWITCHD_BRIDGE_H #define VSWITCHD_BRIDGE_H 1 -#include -#include - -struct svec; - void bridge_init(const char *remote); +void bridge_exit(void); + void bridge_run(void); void bridge_wait(void); diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index 93f0371c6..cd30c96d3 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -107,6 +107,8 @@ main(int argc, char *argv[]) } poll_block(); } + bridge_exit(); + unixctl_server_destroy(unixctl); return 0; } -- 2.39.5