[PATCH] libxtables: convert iptables and and ip6tables use xtables_free_opts()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



More of a janitorial cleanup than anything else.

cheers,
jamal
commit 64a88234b9f4da9188c5cad3c6f9f267afcb9536
Author: Jamal Hadi Salim <hadi@xxxxxxxxxx>
Date:   Tue Feb 10 15:40:34 2009 -0500

    Make iptables and ip6tables use xtables_free_opts()
    
    Signed-off-by: Jamal Hadi Salim <hadi@xxxxxxxxxx>

diff --git a/ip6tables.c b/ip6tables.c
index 2ac3a1d..b1de41b 100644
--- a/ip6tables.c
+++ b/ip6tables.c
@@ -225,16 +225,6 @@ proto_to_name(u_int8_t proto, int nolookup)
 	return NULL;
 }
 
-static void free_opts(int reset_offset)
-{
-	if (opts != original_opts) {
-		free(opts);
-		opts = original_opts;
-		if (reset_offset)
-			global_option_offset = 0;
-	}
-}
-
 static void
 exit_tryhelp(int status)
 {
@@ -242,7 +232,7 @@ exit_tryhelp(int status)
 		fprintf(stderr, "Error occurred at line: %d\n", line);
 	fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n",
 			program_name, program_name );
-	free_opts(1);
+	xtables_free_opts(1);
 	exit(status);
 }
 
@@ -352,7 +342,7 @@ ip6tables_exit_error(enum xtables_exittype status, const char *msg, ...)
 		fprintf(stderr,
 			"Perhaps ip6tables or your kernel needs to be upgraded.\n");
 	/* On error paths, make sure that we don't leak memory */
-	free_opts(1);
+	xtables_free_opts(1);
 	exit(status);
 }
 
@@ -2029,7 +2019,7 @@ int do_command6(int argc, char *argv[], char **table, struct ip6tc_handle **hand
 	for (i = 0; i < ndaddrs; i++)
 		free(&daddrs[i]);
 
-	free_opts(1);
+	xtables_free_opts(1);
 
 	return ret;
 }
diff --git a/iptables.c b/iptables.c
index d079125..dfc1937 100644
--- a/iptables.c
+++ b/iptables.c
@@ -238,16 +238,6 @@ enum {
 	IPT_DOTTED_MASK
 };
 
-static void free_opts(int reset_offset)
-{
-	if (opts != original_opts) {
-		free(opts);
-		opts = original_opts;
-		if (reset_offset)
-			global_option_offset = 0;
-	}
-}
-
 static void
 exit_tryhelp(int status)
 {
@@ -255,7 +245,7 @@ exit_tryhelp(int status)
 		fprintf(stderr, "Error occurred at line: %d\n", line);
 	fprintf(stderr, "Try `%s -h' or '%s --help' for more information.\n",
 			program_name, program_name );
-	free_opts(1);
+	xtables_free_opts(1);
 	exit(status);
 }
 
@@ -365,7 +355,7 @@ iptables_exit_error(enum xtables_exittype status, const char *msg, ...)
 		fprintf(stderr,
 			"Perhaps iptables or your kernel needs to be upgraded.\n");
 	/* On error paths, make sure that we don't leak memory */
-	free_opts(1);
+	xtables_free_opts(1);
 	exit(status);
 }
 
@@ -1321,7 +1311,7 @@ get_kernel_version(void) {
 
 	if (uname(&uts) == -1) {
 		fprintf(stderr, "Unable to retrieve kernel version.\n");
-		free_opts(1);
+		xtables_free_opts(1);
 		exit(1);
 	}
 
@@ -2066,7 +2056,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
 
 	free(saddrs);
 	free(daddrs);
-	free_opts(1);
+	xtables_free_opts(1);
 
 	return ret;
 }

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux