Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
Plug memory leak on remoteDomainScreenshot function.
Version-Release number of selected component (if applicable):
libvirt-0.9.8-0rc2.el6.x86_64
How reproducible:
always
Steps to Reproduce:
1. start a guest
2. valgrind -v --leak-check=full virsh screenshot <guest name>
Actual results:
==17665== 24 bytes in 1 blocks are definitely lost in loss record 4 of 28
==17665== at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==17665== by 0x321FB1497D: xdr_string (in /lib64/libc-2.12.so)
==17665== by 0x3238AFA2AD: xdr_remote_nonnull_string (remote_protocol.c:30)
==17665== by 0x321FB15F4F: xdr_reference (in /lib64/libc-2.12.so)
==17665== by 0x321FB15F10: xdr_pointer (in /lib64/libc-2.12.so)
==17665== by 0x3238AF9E04: xdr_remote_string (remote_protocol.c:39)
==17665== by 0x3238AFA068: xdr_remote_domain_screenshot_ret (remote_protocol.c:1398)
==17665== by 0x3238B09EB2: virNetMessageDecodePayload (virnetmessage.c:382)
==17665== by 0x3238B023FC: virNetClientProgramCall (virnetclientprogram.c:382)
==17665== by 0x3238AE34BD: callWithFD (remote_driver.c:4333)
==17665== by 0x3238AE353B: call (remote_driver.c:4354)
==17665== by 0x3238AF5410: remoteDomainScreenshot (remote_client_bodies.h:1839)
==17665==
==17665== LEAK SUMMARY:
==17665== definitely lost: 24 bytes in 1 blocks
==17665== indirectly lost: 0 bytes in 0 blocks
==17665== possibly lost: 0 bytes in 0 blocks
==17665== still reachable: 126,936 bytes in 1,340 blocks
Expected results:
avoid memory leak.
Additional info:
Should add 'xdr_free((xdrproc_t)xdr_remote_domain_screenshot_ret, (char *)&ret)' to free allocated memory, it needs to change src/rpc/gendispatch.pl,
I'm not familiar with this.
Actually, as we want to keep return value of call(remote_driver.c:4354) and pass it to caller, we don't want to free it completely.
Moreover, the documentation to virDomainScreenshot() says, caller MUST free return value (=mime type of screenshot). And virsh was not doing that. However, was fixed:
commit 0fe2b40d5a1858f7eb0d42f46393e566b6d60812
Author: Michal Privoznik <mprivozn>
AuthorDate: Mon Dec 12 15:57:28 2011 +0100
Commit: Michal Privoznik <mprivozn>
CommitDate: Mon Dec 12 15:57:28 2011 +0100
virsh: Free returned MIME type string
In terms of documentation to virDomainScreenshot, caller MUST free
returned value. But virsh was not.
Therefore moving to POST.
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/RHSA-2012-0748.html