if (r < 0)
return r;
- return set_put(m->rules, rule);
+ r = set_put(m->rules, rule);
+ if (r < 0)
+ return r;
+ if (r == 0)
+ routing_policy_rule_free(rule);
}
return -ENOENT;
r = set_put(*rules, rule);
if (r < 0)
return r;
+ if (r == 0)
+ return -EEXIST;
if (ret)
*ret = rule;
log_warning_errno(r, "Failed to add RPDB rule to saved DB, ignoring: %s", p);
continue;
}
-
- rule = NULL;
+ if (r > 0)
+ rule = NULL;
}
return 0;