[PATCH] msg: Remove unnecessary call of nlmsg_free on known NULL pointer
Tobias Klauser
tklauser at distanz.ch
Fri May 30 07:10:07 PDT 2014
In nlmsg_convert, if __nlmsg_alloc fails we can return NULL directly
instead of unnecessarilyunnecessarily calling nlmsg_free on the NULL pointer.
Signed-off-by: Tobias Klauser <tklauser at distanz.ch>
---
lib/msg.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/msg.c b/lib/msg.c
index 87ebe48..68f706e 100644
--- a/lib/msg.c
+++ b/lib/msg.c
@@ -385,14 +385,11 @@ struct nl_msg *nlmsg_convert(struct nlmsghdr *hdr)
nm = __nlmsg_alloc(NLMSG_ALIGN(hdr->nlmsg_len));
if (!nm)
- goto errout;
+ return NULL;
memcpy(nm->nm_nlh, hdr, hdr->nlmsg_len);
return nm;
-errout:
- nlmsg_free(nm);
- return NULL;
}
/**
--
1.7.9.5
More information about the libnl
mailing list