2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-04 08:15:25 +00:00

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 <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Alex Wang
2014-02-21 14:03:50 -08:00
parent 0c0c32d825
commit 3754832be4

View File

@@ -871,6 +871,7 @@ dp_netdev_flow_unref(struct dp_netdev_flow *flow)
cls_rule_destroy(CONST_CAST(struct cls_rule *, &flow->cr)); cls_rule_destroy(CONST_CAST(struct cls_rule *, &flow->cr));
ovs_mutex_lock(&flow->mutex); ovs_mutex_lock(&flow->mutex);
dp_netdev_actions_unref(flow->actions); dp_netdev_actions_unref(flow->actions);
ovs_refcount_destroy(&flow->ref_cnt);
ovs_mutex_unlock(&flow->mutex); ovs_mutex_unlock(&flow->mutex);
ovs_mutex_destroy(&flow->mutex); ovs_mutex_destroy(&flow->mutex);
free(flow); free(flow);
@@ -1543,6 +1544,7 @@ void
dp_netdev_actions_unref(struct dp_netdev_actions *actions) dp_netdev_actions_unref(struct dp_netdev_actions *actions)
{ {
if (actions && ovs_refcount_unref(&actions->ref_cnt) == 1) { if (actions && ovs_refcount_unref(&actions->ref_cnt) == 1) {
ovs_refcount_destroy(&actions->ref_cnt);
free(actions->actions); free(actions->actions);
free(actions); free(actions);
} }