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:
parent
1087eb5314
commit
872544c0c0
1 changed files with 1 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue