summaryrefslogtreecommitdiff
path: root/lib/msg.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-05-30 16:10:07 +0200
committerThomas Haller <thaller@redhat.com>2014-06-09 12:16:10 +0200
commit872544c0c0283db1e048969d17982398aca6934b (patch)
tree1d80010597eea88806ec157be154a8b3025d0e4f /lib/msg.c
parent1087eb53144cb34e20f82595187ce70853fe4cd9 (diff)
downloadlibnl-872544c0c0283db1e048969d17982398aca6934b.tar.gz
msg: Remove unnecessary call of nlmsg_free on known NULL pointer
In nlmsg_convert, if __nlmsg_alloc fails we can return NULL directly instead of unnecessarily calling nlmsg_free on the NULL pointer. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'lib/msg.c')
-rw-r--r--lib/msg.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/msg.c b/lib/msg.c
index 87ebe48a..68f706ec 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;
}
/**