[package] add memleak fixes from #5875
[openwrt/svn-archive/archive.git] / net / miniupnpd / patches / 001-iptcrdr_memleaks.patch
1 --- a/netfilter/iptcrdr.c
2 +++ b/netfilter/iptcrdr.c
3 @@ -415,11 +415,21 @@ delete_redirect_and_filter_rules(unsigne
4 if(h)
5 {
6 r = delete_rule_and_commit(index, h, miniupnpd_nat_chain, "delete_redirect_rule");
7 +#ifdef IPTABLES_143
8 + iptc_free(h);
9 +#else
10 + iptc_free(&h);
11 +#endif
12 }
13 h = iptc_init("filter");
14 if(h && (r == 0))
15 {
16 r = delete_rule_and_commit(index, h, miniupnpd_forward_chain, "delete_filter_rule");
17 +#ifdef IPTABLES_143
18 + iptc_free(h);
19 +#else
20 + iptc_free(&h);
21 +#endif
22 }
23 }
24 del_redirect_desc(eport, proto);
25 @@ -509,6 +519,11 @@ iptc_init_verify_and_append(const char *
26 {
27 syslog(LOG_ERR, "%s : iptc_is_chain() error : %s\n",
28 logcaller, iptc_strerror(errno));
29 +#ifdef IPTABLES_143
30 + iptc_free(h);
31 +#else
32 + iptc_free(&h);
33 +#endif
34 return -1;
35 }
36 #ifdef IPTABLES_143
37 @@ -519,6 +534,11 @@ iptc_init_verify_and_append(const char *
38 {
39 syslog(LOG_ERR, "%s : iptc_append_entry() error : %s\n",
40 logcaller, iptc_strerror(errno));
41 +#ifdef IPTABLES_143
42 + iptc_free(h);
43 +#else
44 + iptc_free(&h);
45 +#endif
46 return -1;
47 }
48 #ifdef IPTABLES_143
49 @@ -529,8 +549,18 @@ iptc_init_verify_and_append(const char *
50 {
51 syslog(LOG_ERR, "%s : iptc_commit() error : %s\n",
52 logcaller, iptc_strerror(errno));
53 +#ifdef IPTABLES_143
54 + iptc_free(h);
55 +#else
56 + iptc_free(&h);
57 +#endif
58 return -1;
59 }
60 +#ifdef IPTABLES_143
61 + iptc_free(h);
62 +#else
63 + iptc_free(&h);
64 +#endif
65 return 0;
66 }
67