From: Alex Wang Date: Fri, 21 Feb 2014 22:03:50 +0000 (-0800) Subject: dpif-netdev: Call ovs_refcount_destroy() before free(). X-Git-Tag: sliver-openvswitch-2.1.90-1~1^2~12 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=3754832be4195ef5c01ba2af2e4b50b6f8df91bd dpif-netdev: Call ovs_refcount_destroy() before free(). This commit makes dp_netdev_flow_unref() and dp_netdev_actions_unref() invoke the ovs_refcount_destroy() before freeing the corresponding pointer. Signed-off-by: Alex Wang Acked-by: Ben Pfaff --- diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 73eb99d16..9ba93dd07 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -871,6 +871,7 @@ dp_netdev_flow_unref(struct dp_netdev_flow *flow) cls_rule_destroy(CONST_CAST(struct cls_rule *, &flow->cr)); ovs_mutex_lock(&flow->mutex); dp_netdev_actions_unref(flow->actions); + ovs_refcount_destroy(&flow->ref_cnt); ovs_mutex_unlock(&flow->mutex); ovs_mutex_destroy(&flow->mutex); free(flow); @@ -1543,6 +1544,7 @@ void dp_netdev_actions_unref(struct dp_netdev_actions *actions) { if (actions && ovs_refcount_unref(&actions->ref_cnt) == 1) { + ovs_refcount_destroy(&actions->ref_cnt); free(actions->actions); free(actions); }