Bug 1158722
| Summary: | A memory leak in cmdNetworkDHCPLeases | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Luyao Huang <lhuang> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 7.1 | CC: | dyuan, hliu, honzhang, mzhan, pkrempa, rbalakri |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.13-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 05:54:54 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Luyao Huang
2014-10-30 03:30:55 UTC
Fixed upstream:
commit 089663aefaed6ae7acd5d8bdd362030ff661dce1
Author: Luyao Huang <lhuang>
Date: Thu Oct 30 10:35:14 2014 +0800
virsh: Fix memory leak in cmdNetworkDHCPLeases
After cidr_format is allocated by virAsprintf and used by vshPrintExtra
it needs to be freed.
Fix the following memory leak from valgrind:
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 <lhuang>
I can produce this on build libvirt-1.2.8-5.el7.x86_64
verify this bug on build libvirt-1.2.15-2.el7.x86_64
1. prepare a guest with interface
...
<interface type='network'>
<mac address='52:54:00:29:f7:6e'/>
<source network='default' bridge='virbr0'/>
<target dev='vnet0'/>
<model type='rtl8139'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<interface type='network'>
<mac address='52:54:00:2d:14:70'/>
<source network='default' bridge='virbr0'/>
<target dev='vnet1'/>
<model type='rtl8139'/>
<alias name='net2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</interface>
...
2. check net-dhcp-leases
# valgrind -v --leak-check=full virsh net-dhcp-leases default
...
Expiry Time MAC address Protocol IP address Hostname Client ID or DUID
-------------------------------------------------------------------------------------------------------------------
2015-05-22 15:55:34 52:54:00:29:f7:6e ipv4 192.168.122.203/24 localhost -
2015-05-22 15:55:34 52:54:00:2d:14:70 ipv4 192.168.122.72/24 - -
==23838==
==23838== HEAP SUMMARY:
==23838== in use at exit: 103,733 bytes in 1,084 blocks
==23838== total heap usage: 4,355 allocs, 3,271 frees, 1,203,039 bytes allocated
==23838==
==23838== Searching for pointers to 1,084 not-freed blocks
==23838== Checked 1,464,496 bytes
==23838==
==23838== LEAK SUMMARY:
==23838== definitely lost: 0 bytes in 0 blocks
==23838== indirectly lost: 0 bytes in 0 blocks
==23838== possibly lost: 0 bytes in 0 blocks
==23838== still reachable: 103,733 bytes in 1,084 blocks
==23838== suppressed: 0 bytes in 0 blocks
==23838== Reachable blocks (those to which a pointer was found) are not shown.
==23838== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==23838==
==23838== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
--23838--
--23838-- used_suppression: 2 glibc-2.5.x-on-SUSE-10.2-(PPC)-2a /usr/lib64/valgrind/default.supp:1296
==23838==
==23838== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
no memory leak, move to verified
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2202.html |