Use new l_memdup() function instead of l_malloc() followed by
memcpy().
---
ell/genl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/ell/genl.c b/ell/genl.c
index dca8e1b..d2c1784 100644
--- a/ell/genl.c
+++ b/ell/genl.c
@@ -257,13 +257,11 @@ static struct l_genl_msg *msg_create(const struct nlmsghdr *nlmsg)
goto done;
}
- msg->data = l_malloc(nlmsg->nlmsg_len);
+ msg->data = l_memdup(nlmsg, nlmsg->nlmsg_len);
msg->len = nlmsg->nlmsg_len;
msg->size = nlmsg->nlmsg_len;
- memcpy(msg->data, nlmsg, nlmsg->nlmsg_len);
-
if (msg->len >= GENL_HDRLEN) {
struct genlmsghdr *genlmsg = msg->data + NLMSG_HDRLEN;
--
1.8.3.1