summaryrefslogtreecommitdiffstats
path: root/ip6tables.c
diff options
context:
space:
mode:
authorMartin Josefsson <gandalf@wlug.westbo.se>2003-05-02 15:30:11 +0000
committerHarald Welte <laforge@gnumonks.org>2003-05-02 15:30:11 +0000
commit841e4aed2349046eb2c0b1375139c06569a93bd0 (patch)
tree9f7a208076fc164ca3d52e745964c7dbc7afc350 /ip6tables.c
parent59cbe17cee0499c8f25a8d9f29513f4c85e9b03c (diff)
fix memory leak(s) in libiptc. Reverts the previous (wrong) patch. (Martin Josefsson)
Diffstat (limited to 'ip6tables.c')
-rw-r--r--ip6tables.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ip6tables.c b/ip6tables.c
index 17bdb4e5..d2508825 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -1670,6 +1670,7 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle)
const char *modprobe = NULL;
int proto_used = 0;
char icmp6p[] = "icmpv6";
+ int no_handle = 0;
memset(&fw, 0, sizeof(fw));
@@ -2147,8 +2148,10 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle)
chain, IP6T_FUNCTION_MAXNAMELEN);
/* only allocate handle if we weren't called with a handle */
- if (!*handle)
+ if (!*handle) {
*handle = ip6tc_init(*table);
+ no_handle = 1;
+ }
if (!*handle) {
/* try to insmod the module if iptc_init failed */
@@ -2293,5 +2296,8 @@ int do_command6(int argc, char *argv[], char **table, ip6tc_handle_t *handle)
if (verbose > 1)
dump_entries6(*handle);
+ if (no_handle)
+ ip6tc_free(handle);
+
return ret;
}