From 15749c8937da54b0b73e9c13ab026ff888e84bd0 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 30 Apr 2009 12:57:20 -0700 Subject: [PATCH] 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. --- datapath/datapath.c | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- 2.30.2