Re: [libvirt] [PATCH] Fix memory leak in cmdNetworkDHCPLeases
In subject: I've added virsh: designator to make clear which part of the code the patch touches. On 10/30/14 03:35, Luyao Huang wrote: After use cidr_format in function virAsprintf and vshPrintExtra, need free cidr_format. And clarified this sentence a bit. Fix the following memory leak from valgrind, like: 18 bytes in 1 blocks are definitely lost in loss record 41 of 192 at 0x4C29BBD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x85CE36F: __vasprintf_chk (vasprintf_chk.c:80) by 0x4EE52D5: UnknownInlinedFun (stdio2.h:210) by 0x4EE52D5: virVasprintfInternal (virstring.c:459) by 0x4EE53CA: virAsprintfInternal (virstring.c:480) by 0x14FE96: cmdNetworkDHCPLeases (virsh-network.c:1378) by 0x13006B: vshCommandRun (virsh.c:1915) by 0x12A9E1: main (virsh.c:3699) Signed-off-by: Luyao Huang lhu...@redhat.com --- tools/virsh-network.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 90392d3..8ff6fd8 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1381,6 +1381,8 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd) expirytime, EMPTYSTR(lease-mac), EMPTYSTR(typestr), cidr_format, EMPTYSTR(lease-hostname), EMPTYSTR(lease-clientid)); + + VIR_FREE(cidr_format); } ret = true; ACK, thanks for taking your time and fixing the issue. I'll push the patch shortly. Peter signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix memory leak in cmdNetworkDHCPLeases
On 10/30/14 03:35, Luyao Huang wrote: After use cidr_format in function virAsprintf and vshPrintExtra, need free cidr_format. Fix the following memory leak from valgrind, like: 18 bytes in 1 blocks are definitely lost in loss record 41 of 192 at 0x4C29BBD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x85CE36F: __vasprintf_chk (vasprintf_chk.c:80) by 0x4EE52D5: UnknownInlinedFun (stdio2.h:210) by 0x4EE52D5: virVasprintfInternal (virstring.c:459) by 0x4EE53CA: virAsprintfInternal (virstring.c:480) by 0x14FE96: cmdNetworkDHCPLeases (virsh-network.c:1378) by 0x13006B: vshCommandRun (virsh.c:1915) by 0x12A9E1: main (virsh.c:3699) Signed-off-by: Luyao Huang lhu...@redhat.com --- tools/virsh-network.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 90392d3..8ff6fd8 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1381,6 +1381,8 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd) expirytime, EMPTYSTR(lease-mac), EMPTYSTR(typestr), cidr_format, EMPTYSTR(lease-hostname), EMPTYSTR(lease-clientid)); + + VIR_FREE(cidr_format); I didn't notice at first, but you've used a TAB to indent VIR_FREE. Our coding style enforces use of spaces instead. Please run 'make syntax-check before sending patches. I'll fix the problem before pushing. } ret = true; Peter signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix memory leak in cmdNetworkDHCPLeases
On 10/30/2014 02:27 PM, Peter Krempa wrote: On 10/30/14 03:35, Luyao Huang wrote: After use cidr_format in function virAsprintf and vshPrintExtra, need free cidr_format. Fix the following memory leak from valgrind, like: 18 bytes in 1 blocks are definitely lost in loss record 41 of 192 at 0x4C29BBD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x85CE36F: __vasprintf_chk (vasprintf_chk.c:80) by 0x4EE52D5: UnknownInlinedFun (stdio2.h:210) by 0x4EE52D5: virVasprintfInternal (virstring.c:459) by 0x4EE53CA: virAsprintfInternal (virstring.c:480) by 0x14FE96: cmdNetworkDHCPLeases (virsh-network.c:1378) by 0x13006B: vshCommandRun (virsh.c:1915) by 0x12A9E1: main (virsh.c:3699) Signed-off-by: Luyao Huang lhu...@redhat.com --- tools/virsh-network.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 90392d3..8ff6fd8 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1381,6 +1381,8 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd) expirytime, EMPTYSTR(lease-mac), EMPTYSTR(typestr), cidr_format, EMPTYSTR(lease-hostname), EMPTYSTR(lease-clientid)); + + VIR_FREE(cidr_format); I didn't notice at first, but you've used a TAB to indent VIR_FREE. Our coding style enforces use of spaces instead. Please run 'make syntax-check before sending patches. I'll fix the problem before pushing. Oh sorry,i forgot it, thanks your advise :) } ret = true; Peter -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix memory leak in cmdNetworkDHCPLeases
After use cidr_format in function virAsprintf and vshPrintExtra, need free cidr_format. Fix the following memory leak from valgrind, like: 18 bytes in 1 blocks are definitely lost in loss record 41 of 192 at 0x4C29BBD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x85CE36F: __vasprintf_chk (vasprintf_chk.c:80) by 0x4EE52D5: UnknownInlinedFun (stdio2.h:210) by 0x4EE52D5: virVasprintfInternal (virstring.c:459) by 0x4EE53CA: virAsprintfInternal (virstring.c:480) by 0x14FE96: cmdNetworkDHCPLeases (virsh-network.c:1378) by 0x13006B: vshCommandRun (virsh.c:1915) by 0x12A9E1: main (virsh.c:3699) Signed-off-by: Luyao Huang lhu...@redhat.com --- tools/virsh-network.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 90392d3..8ff6fd8 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -1381,6 +1381,8 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd) expirytime, EMPTYSTR(lease-mac), EMPTYSTR(typestr), cidr_format, EMPTYSTR(lease-hostname), EMPTYSTR(lease-clientid)); + + VIR_FREE(cidr_format); } ret = true; -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list