[PATCH] net, ipv6: remove redundant NULL checks before kfree in ip6_flowlabel.c

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

 



kfree() has no problems dealing with NULL pointers, so wrapping checks for 
null round calls to it is redundant. This patch gets rid of two such 
checks in net/ipv6/ip6_flowlabel.c

I considered also rewriting the 
        if (fl)
                fl_free(fl);
bit as simply fl_free(fl) as well, but that if() potentially saves two 
calls to kfree() inside fl_free as well as the call to fl_free itself, so 
I guess that's worth the if().

Please consider applying.


Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

diff -up linux-2.6.11-mm4-orig/net/ipv6/ip6_flowlabel.c linux-2.6.11-mm4/net/ipv6/ip6_flowlabel.c
--- linux-2.6.11-mm4-orig/net/ipv6/ip6_flowlabel.c	2005-03-02 08:37:50.000000000 +0100
+++ linux-2.6.11-mm4/net/ipv6/ip6_flowlabel.c	2005-03-17 00:23:30.000000000 +0100
@@ -87,8 +87,7 @@ static struct ip6_flowlabel * fl_lookup(
 
 static void fl_free(struct ip6_flowlabel *fl)
 {
-	if (fl->opt)
-		kfree(fl->opt);
+	kfree(fl->opt);
 	kfree(fl);
 }
 
@@ -553,8 +552,7 @@ release:
 done:
 	if (fl)
 		fl_free(fl);
-	if (sfl1)
-		kfree(sfl1);
+	kfree(sfl1);
 	return err;
 }
 



-- 
Jesper Juhl

PS. Please CC me on replies from lists other than linux-kernel


-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux