This is our customary way to implement a "destroy" function. It allows
a minor simplification in ofoperation_complete().
Signed-off-by: Ben Pfaff <blp@nicira.com>
static void
ofproto_rule_destroy__(struct rule *rule)
{
- free(rule->actions);
- rule->ofproto->ofproto_class->rule_dealloc(rule);
+ if (rule) {
+ free(rule->actions);
+ rule->ofproto->ofproto_class->rule_dealloc(rule);
+ }
}
/* This function allows an ofproto implementation to destroy any rules that
switch (op->type) {
case OFOPERATION_ADD:
if (!error) {
- if (op->victim) {
- ofproto_rule_destroy__(op->victim);
- }
+ ofproto_rule_destroy__(op->victim);
if ((rule->cr.wc.vlan_tci_mask & htons(VLAN_VID_MASK))
== htons(VLAN_VID_MASK)) {
if (ofproto->vlan_bitmap) {