| Summary: | memory leak when run virsh vol-path command | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Alex Jia <ajia> |
| Component: | libvirt | Assignee: | Osier Yang <jyang> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | high | ||
| Version: | 6.2 | CC: | dallan, dyuan, mzhan, rwu, vbian |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-0.9.4-rc2-1.el6 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-12-06 11:17:53 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
|
Description
Alex Jia
2011-07-27 03:24:37 UTC
This is a patch: https://www.redhat.com/archives/libvir-list/2011-July/msg01877.html commit 1768bf63edf96c66aba25ddf85b2bf3a6b842630
Author: Alex Jia <ajia>
Date: Thu Jul 28 10:42:51 2011 +0800
virsh: fix memory leak in cmdVolPath code
* tools/virsh.c: avoid memory leak in cmdVolPath.
* src/libvirt.c: Add doc for virStorageVolGetPath to tell one
must free() the returned path after use.
* how to reproduce?
% dd if=/dev/zero of=/var/lib/libvirt/images/foo.img count=1 bs=10M
% virsh pool-refresh default
% valgrind -v --leak-check=full virsh vol-path --vol \
/var/lib/libvirt/images/foo.img
* actual results:
Detected in valgrind run:
==16436== 32 bytes in 1 blocks are definitely lost in loss record 7 of 22
==16436== at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==16436== by 0x386A314B3D: xdr_string (in /lib64/libc-2.12.so)
==16436== by 0x3DF8CD770D: xdr_remote_nonnull_string (remote_protocol.c:3
==16436== by 0x3DF8CD7EC8: xdr_remote_storage_vol_get_path_ret
% virsh pool-refresh default
% valgrind -v --leak-check=full virsh vol-path --vol \
/var/lib/libvirt/images/foo.img
Signed-off-by: Alex Jia <ajia>
Patch pushed to upstream, move to POST.
tested with libvirt-0.9.4-0rc2.el6.x86_64 1.virsh pool-list and make sure default pool is active 2.dd if=/dev/zero of=/var/lib/libvirt/images/foo.img count=1 bs=10M 3.virsh pool-refresh default 4.valgrind -v --leak-check=full virsh vol-path --vol /var/lib/libvirt/images/foo.img ==13559== ==13559== HEAP SUMMARY: ==13559== in use at exit: 331,401 bytes in 53 blocks ==13559== total heap usage: 884 allocs, 831 frees, 2,083,975 bytes allocated ==13559== ==13559== Searching for pointers to 53 not-freed blocks ==13559== Checked 1,518,592 bytes ==13559== ==13559== LEAK SUMMARY: ==13559== definitely lost: 0 bytes in 0 blocks ==13559== indirectly lost: 0 bytes in 0 blocks ==13559== possibly lost: 0 bytes in 0 blocks ==13559== still reachable: 331,401 bytes in 53 blocks ==13559== suppressed: 0 bytes in 0 blocks ==13559== Reachable blocks (those to which a pointer was found) are not shown. ==13559== To see them, rerun with: --leak-check=full --show-reachable=yes ==13559== ==13559== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 4) --13559-- --13559-- used_suppression: 6 U1004-ARM-_dl_relocate_object ==13559== ==13559== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 4) There is no memory leak and I/O error , so set bug status 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. http://rhn.redhat.com/errata/RHBA-2011-1513.html |