Commit 9d053394 by Gaurav Singh

nl: fix memory leak

parent ebe4f04e
......@@ -106,8 +106,10 @@ struct nlmsg *nlmsg_alloc(size_t size)
return ret_set_errno(NULL, ENOMEM);
nlmsg->nlmsghdr = malloc(len);
if (!nlmsg->nlmsghdr)
if (!nlmsg->nlmsghdr) {
free(nlmsg);
return ret_set_errno(NULL, ENOMEM);
}
memset(nlmsg->nlmsghdr, 0, len);
nlmsg->cap = len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment