It is safe to call kfree(NULL) which makes this extra check unneeded. It was found using checkpatch.pl from linux-2.6
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de --- batman-adv-kernelland/hard-interface.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/batman-adv-kernelland/hard-interface.c b/batman-adv-kernelland/hard-interface.c index e9cb977..28d02f6 100644 --- a/batman-adv-kernelland/hard-interface.c +++ b/batman-adv-kernelland/hard-interface.c @@ -399,8 +399,7 @@ int hardif_add_interface(char *dev, int if_num) return 1;
out: - if (batman_if->packet_buff) - kfree(batman_if->packet_buff); + kfree(batman_if->packet_buff); kfree(batman_if); kfree(dev); return -1;
Hello Sven,
thank you, applied in svn revision r1493.
best regards Simon
On Thu, Dec 10, 2009 at 08:00:57PM +0100, Sven Eckelmann wrote:
It is safe to call kfree(NULL) which makes this extra check unneeded. It was found using checkpatch.pl from linux-2.6
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de
batman-adv-kernelland/hard-interface.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/batman-adv-kernelland/hard-interface.c b/batman-adv-kernelland/hard-interface.c index e9cb977..28d02f6 100644 --- a/batman-adv-kernelland/hard-interface.c +++ b/batman-adv-kernelland/hard-interface.c @@ -399,8 +399,7 @@ int hardif_add_interface(char *dev, int if_num) return 1;
out:
- if (batman_if->packet_buff)
kfree(batman_if->packet_buff);
- kfree(batman_if->packet_buff); kfree(batman_if); kfree(dev); return -1;
-- 1.6.5.4
B.A.T.M.A.N mailing list B.A.T.M.A.N@lists.open-mesh.net https://lists.open-mesh.net/mm/listinfo/b.a.t.m.a.n
b.a.t.m.a.n@lists.open-mesh.org