* [PATCH] examples: Fix memory leaks detected by Valgrind
@ 2017-08-29 12:49 Shyam Saini
2017-08-29 21:39 ` Arturo Borrero Gonzalez
2017-09-04 20:49 ` Pablo Neira Ayuso
0 siblings, 2 replies; 4+ messages in thread
From: Shyam Saini @ 2017-08-29 12:49 UTC (permalink / raw)
To: netfilter-devel; +Cc: Shyam Saini
==11688== HEAP SUMMARY:
==11688== in use at exit: 40 bytes in 1 blocks
==11688== total heap usage: 7 allocs, 6 frees, 220 bytes allocated
==11688==
==11688== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
==11688== at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11688== by 0x5068955: mnl_nlmsg_batch_start (nlmsg.c:441)
==11688== by 0x40133B: main (nft-chain-add.c:103)
==11688==
==11688== LEAK SUMMARY:
==11688== definitely lost: 40 bytes in 1 blocks
==11688== indirectly lost: 0 bytes in 0 blocks
==11688== possibly lost: 0 bytes in 0 blocks
==11688== still reachable: 0 bytes in 0 blocks
==11688== suppressed: 0 bytes in 0 blocks
==11831== HEAP SUMMARY:
==11831== in use at exit: 40 bytes in 1 blocks
==11831== total heap usage: 7 allocs, 6 frees, 220 bytes allocated
==11831==
==11831== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
==11831== at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11831== by 0x5068955: mnl_nlmsg_batch_start (nlmsg.c:441)
==11831== by 0x401154: main (nft-chain-del.c:79)
==11831==
==11831== LEAK SUMMARY:
==11831== definitely lost: 40 bytes in 1 blocks
==11831== indirectly lost: 0 bytes in 0 blocks
==11831== possibly lost: 0 bytes in 0 blocks
==11831== still reachable: 0 bytes in 0 blocks
==11831== suppressed: 0 bytes in 0 blocks
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
---
examples/nft-chain-add.c | 2 ++
examples/nft-chain-del.c | 2 ++
examples/nft-chain-parse-add.c | 4 +++-
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/examples/nft-chain-add.c b/examples/nft-chain-add.c
index ca1edf9e6f86..e0d889df40eb 100644
--- a/examples/nft-chain-add.c
+++ b/examples/nft-chain-add.c
@@ -138,6 +138,8 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
+ mnl_nlmsg_batch_stop(batch);
+
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
while (ret > 0) {
ret = mnl_cb_run(buf, ret, chain_seq, portid, NULL, NULL);
diff --git a/examples/nft-chain-del.c b/examples/nft-chain-del.c
index b756b46f9bbd..3a43fd424eb9 100644
--- a/examples/nft-chain-del.c
+++ b/examples/nft-chain-del.c
@@ -113,6 +113,8 @@ int main(int argc, char *argv[])
perror("mnl_socket_send");
exit(EXIT_FAILURE);
}
+
+ mnl_nlmsg_batch_stop(batch);
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
while (ret > 0) {
diff --git a/examples/nft-chain-parse-add.c b/examples/nft-chain-parse-add.c
index 6d6d989cd81d..abb9ac4641f5 100644
--- a/examples/nft-chain-parse-add.c
+++ b/examples/nft-chain-parse-add.c
@@ -148,7 +148,9 @@ int main(int argc, char *argv[])
perror("mnl_socket_send");
exit(EXIT_FAILURE);
}
-
+
+ mnl_nlmsg_batch_stop(batch);
+
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
while (ret > 0) {
ret = mnl_cb_run(buf, ret, chain_seq, portid, NULL, NULL);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] examples: Fix memory leaks detected by Valgrind
2017-08-29 12:49 [PATCH] examples: Fix memory leaks detected by Valgrind Shyam Saini
@ 2017-08-29 21:39 ` Arturo Borrero Gonzalez
2017-08-30 7:18 ` Shyam Saini
2017-09-04 20:49 ` Pablo Neira Ayuso
1 sibling, 1 reply; 4+ messages in thread
From: Arturo Borrero Gonzalez @ 2017-08-29 21:39 UTC (permalink / raw)
To: Shyam Saini; +Cc: Netfilter Development Mailing list
Thanks Shyam,
Acked-by: Arturo Borrero Gonzalez <arturo@netfilter.org>
in the future, please add a tag to the [PATCH] header, like "[PATCH
libnftnl]" so we can easily know to which tree this patch should be
applied to.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] examples: Fix memory leaks detected by Valgrind
2017-08-29 21:39 ` Arturo Borrero Gonzalez
@ 2017-08-30 7:18 ` Shyam Saini
0 siblings, 0 replies; 4+ messages in thread
From: Shyam Saini @ 2017-08-30 7:18 UTC (permalink / raw)
To: Arturo Borrero Gonzalez; +Cc: Netfilter Development Mailing list
On Wed, Aug 30, 2017 at 3:09 AM, Arturo Borrero Gonzalez
<arturo@netfilter.org> wrote:
> Thanks Shyam,
>
> Acked-by: Arturo Borrero Gonzalez <arturo@netfilter.org>
> in the future, please add a tag to the [PATCH] header, like "[PATCH
> libnftnl]" so we can easily know to which tree this patch should be
> applied to.
Thanks Arturo
I'll follow this thing next time onward.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] examples: Fix memory leaks detected by Valgrind
2017-08-29 12:49 [PATCH] examples: Fix memory leaks detected by Valgrind Shyam Saini
2017-08-29 21:39 ` Arturo Borrero Gonzalez
@ 2017-09-04 20:49 ` Pablo Neira Ayuso
1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2017-09-04 20:49 UTC (permalink / raw)
To: Shyam Saini; +Cc: netfilter-devel
On Tue, Aug 29, 2017 at 06:19:36PM +0530, Shyam Saini wrote:
> ==11688== HEAP SUMMARY:
> ==11688== in use at exit: 40 bytes in 1 blocks
> ==11688== total heap usage: 7 allocs, 6 frees, 220 bytes allocated
> ==11688==
> ==11688== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
> ==11688== at 0x4C2AB80: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==11688== by 0x5068955: mnl_nlmsg_batch_start (nlmsg.c:441)
> ==11688== by 0x40133B: main (nft-chain-add.c:103)
> ==11688==
> ==11688== LEAK SUMMARY:
> ==11688== definitely lost: 40 bytes in 1 blocks
> ==11688== indirectly lost: 0 bytes in 0 blocks
> ==11688== possibly lost: 0 bytes in 0 blocks
> ==11688== still reachable: 0 bytes in 0 blocks
> ==11688== suppressed: 0 bytes in 0 blocks
>
> ==11831== HEAP SUMMARY:
> ==11831== in use at exit: 40 bytes in 1 blocks
> ==11831== total heap usage: 7 allocs, 6 frees, 220 bytes allocated
> ==11831==
> ==11831== 40 bytes in 1 blocks are definitely lost in loss record 1 of 1
> ==11831== at 0x4C2AB80: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==11831== by 0x5068955: mnl_nlmsg_batch_start (nlmsg.c:441)
> ==11831== by 0x401154: main (nft-chain-del.c:79)
> ==11831==
> ==11831== LEAK SUMMARY:
> ==11831== definitely lost: 40 bytes in 1 blocks
> ==11831== indirectly lost: 0 bytes in 0 blocks
> ==11831== possibly lost: 0 bytes in 0 blocks
> ==11831== still reachable: 0 bytes in 0 blocks
> ==11831== suppressed: 0 bytes in 0 blocks
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-04 20:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 12:49 [PATCH] examples: Fix memory leaks detected by Valgrind Shyam Saini
2017-08-29 21:39 ` Arturo Borrero Gonzalez
2017-08-30 7:18 ` Shyam Saini
2017-09-04 20:49 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.