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>
This commit is contained in:
Tobias Klauser 2014-05-30 16:10:07 +02:00 committed by Thomas Haller
parent 1087eb5314
commit 872544c0c0

View file

@ -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;
}
/**