From: Ben Pfaff Date: Thu, 30 Apr 2009 19:57:20 +0000 (-0700) Subject: datapath: Fix memory leak in port group. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15749c8937da54b0b73e9c13ab026ff888e84bd0;p=openvswitch datapath: Fix memory leak in port group. When we destroy a datapath, we need to free its port groups also. This is a fairly small memory leak: a few hundred bytes, at most, and it only occurred each time a datapath was destroyed. --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 2be82df0..f6ad8a69 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -307,6 +307,13 @@ static void do_destroy_dp(struct datapath *dp) dp_table_destroy(dp->table, 1); for (i = 0; i < DP_N_QUEUES; i++) skb_queue_purge(&dp->queues[i]); + for (i = 0; i < DP_MAX_GROUPS; i++) { + struct odp_port_group *pg = dp->groups[i]; + if (pg) { + kfree(dp->groups[i]->ports); + kfree(dp->groups[i]); + } + } free_percpu(dp->stats_percpu); kfree(dp); module_put(THIS_MODULE);