@@ -219,6 +219,7 @@ static ssize_t mnl_nft_socket_sendmsg(const struct mnl_socket *nl)
};
struct batch_page *batch_page, *next;
int i = 0;
+ ssize_t ret = 0;
mnl_set_sndbuffer(nl);
@@ -240,7 +241,11 @@ static ssize_t mnl_nft_socket_sendmsg(const struct mnl_socket *nl)
batch_num_pages--;
}
- return sendmsg(mnl_socket_get_fd(nl), &msg, 0);
+ ret = sendmsg(mnl_socket_get_fd(nl), &msg, 0);
+ for (i = 0; (size_t)i < msg.msg_iovlen; i++)
+ xfree(iov[i].iov_base);
+
+ return ret;
}
int mnl_batch_talk(struct mnl_socket *nl, struct list_head *err_list)
The real buffers used by batch operation are forgotten to release. Just release them. To test this patch, an other patch[1] must be applied first. If not, the bug described in that patch will be reproduced. [1] [nftables PATCH] Fix segmentation fault in batch operation Signed-off-by: Yanchuan Nian <ycnian@gmail.com> --- src/mnl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)