summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/msg.c4
-rw-r--r--lib/nl.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/msg.c b/lib/msg.c
index 3d4fbc6..c5cb7b4 100644
--- a/lib/msg.c
+++ b/lib/msg.c
@@ -372,10 +372,12 @@ static struct nl_msg *__nlmsg_alloc(size_t len)
if (!nm)
goto errout;
- nm->nm_nlh = calloc(1, len);
+ nm->nm_nlh = malloc(len);
if (!nm->nm_nlh)
goto errout;
+ memset(nm->nm_nlh, 0, sizeof(struct nlmsghdr));
+
nm->nm_protocol = -1;
nm->nm_size = len;
nm->nm_nlh->nlmsg_len = nlmsg_total_size(0);
diff --git a/lib/nl.c b/lib/nl.c
index 3281739..9b6fb9b 100644
--- a/lib/nl.c
+++ b/lib/nl.c
@@ -482,7 +482,7 @@ int nl_recv(struct nl_handle *handle, struct sockaddr_nl *nla,
page_size = getpagesize();
iov.iov_len = page_size;
- iov.iov_base = *buf = calloc(1, iov.iov_len);
+ iov.iov_base = *buf = malloc(iov.iov_len);
if (handle->h_flags & NL_SOCK_PASSCRED) {
msg.msg_controllen = CMSG_SPACE(sizeof(struct ucred));