iptcrdr.c: fix a potential double iptc_free(h)
closes
@@ -627,7 +627,8 @@ get_peer_rule_by_index(int index,
}
/* delete_rule_and_commit() :
- * subfunction used in delete_redirect_and_filter_rules() */
+ * subfunction used in delete_redirect_and_filter_rules()
+ * always call iptc_free(h) */
static int
delete_rule_and_commit(unsigned int index, IPTC_HANDLE h,
const char * miniupnpd_chain,
@@ -853,7 +854,8 @@ delete_redirect_and_filter_rules(unsigned short eport, int proto)
break;
}
}
- }
+ /* in case the filter rule has not been found, delete_rule_and_commit() is not called
+ * so we neet to free h */
if(h)
#ifdef IPTABLES_143
iptc_free(h);
@@ -861,6 +863,7 @@ delete_redirect_and_filter_rules(unsigned short eport, int proto)
iptc_free(&h);
#endif
}
+ }
/*delete PEER rule*/
if((h = iptc_init("nat")))
