diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2014-05-30 16:10:07 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-06-09 12:16:10 +0200 |
commit | 872544c0c0283db1e048969d17982398aca6934b (patch) | |
tree | 1d80010597eea88806ec157be154a8b3025d0e4f /lib/msg.c | |
parent | 1087eb53144cb34e20f82595187ce70853fe4cd9 (diff) | |
download | libnl-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.c | 5 |
1 files changed, 1 insertions, 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; } /** |