netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: domen@coderock.org
To: davem@redhat.com
Cc: netdev@oss.sgi.com, domen@coderock.org, jlamanna@gmail.com
Subject: [patch 1/5] ebtables.c - vfree() checking cleanups
Date: Sun, 06 Mar 2005 23:21:07 +0100	[thread overview]
Message-ID: <20050306222108.782C61EC90@trashy.coderock.org> (raw)



ebtables.c vfree() checking cleanups.

Signed-off by: James Lamanna <jlamanna@gmail.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
---


 kj-domen/net/bridge/netfilter/ebtables.c |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)

diff -puN net/bridge/netfilter/ebtables.c~vfree-net_bridge_netfilter_ebtables net/bridge/netfilter/ebtables.c
--- kj/net/bridge/netfilter/ebtables.c~vfree-net_bridge_netfilter_ebtables	2005-03-05 16:10:40.000000000 +0100
+++ kj-domen/net/bridge/netfilter/ebtables.c	2005-03-05 16:10:40.000000000 +0100
@@ -858,8 +858,7 @@ static int translate_table(struct ebt_re
 		if (repl->valid_hooks & (1 << i))
 			if (check_chainloops(newinfo->hook_entry[i],
 			   cl_s, udc_cnt, i, newinfo->entries)) {
-				if (cl_s)
-					vfree(cl_s);
+				vfree(cl_s);
 				return -EINVAL;
 			}
 
@@ -882,8 +881,7 @@ static int translate_table(struct ebt_re
 		EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
 		   ebt_cleanup_entry, &i);
 	}
-	if (cl_s)
-		vfree(cl_s);
+	vfree(cl_s);
 	return ret;
 }
 
@@ -1029,8 +1027,7 @@ static int do_replace(void __user *user,
 	}
 	vfree(table);
 
-	if (counterstmp)
-		vfree(counterstmp);
+	vfree(counterstmp);
 	return ret;
 
 free_unlock:
@@ -1039,8 +1036,7 @@ free_iterate:
 	EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
 	   ebt_cleanup_entry, NULL);
 free_counterstmp:
-	if (counterstmp)
-		vfree(counterstmp);
+	vfree(counterstmp);
 	/* can be initialized in translate_table() */
 	if (newinfo->chainstack) {
 		for (i = 0; i < NR_CPUS; i++)
@@ -1048,11 +1044,9 @@ free_counterstmp:
 		vfree(newinfo->chainstack);
 	}
 free_entries:
-	if (newinfo->entries)
-		vfree(newinfo->entries);
+	vfree(newinfo->entries);
 free_newinfo:
-	if (newinfo)
-		vfree(newinfo);
+	vfree(newinfo);
 	return ret;
 }
 
@@ -1212,8 +1206,7 @@ void ebt_unregister_table(struct ebt_tab
 	down(&ebt_mutex);
 	LIST_DELETE(&ebt_tables, table);
 	up(&ebt_mutex);
-	if (table->private->entries)
-		vfree(table->private->entries);
+	vfree(table->private->entries);
 	if (table->private->chainstack) {
 		for (i = 0; i < NR_CPUS; i++)
 			vfree(table->private->chainstack[i]);
_

                 reply	other threads:[~2005-03-06 22:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050306222108.782C61EC90@trashy.coderock.org \
    --to=domen@coderock.org \
    --cc=davem@redhat.com \
    --cc=jlamanna@gmail.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).