From: Ben Pfaff Date: Mon, 13 Dec 2010 21:08:31 +0000 (-0800) Subject: ovs-vswitchd: Release most memory on normal exit. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee45ad81ab7e9ff6034352b6743985e28fedd649;p=openvswitch ovs-vswitchd: Release most memory on normal exit. This makes "valgrind --leak-check=full --show-reachable=yes" output much easier to read. --- diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 18e4ef24..f739505e 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 42ba4e5c..32b581e2 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 93f0371c..cd30c96d 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; }