Bug 1116427

Summary: Memory leak in virConnectOpenAuth
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, jtomko
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-07 06:51:07 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 Richard W.M. Jones 2014-07-04 14:41:03 UTC
Description of problem:

As revealed by valgrind:

==25515== 19 bytes in 1 blocks are definitely lost in loss record 59 of 318
==25515==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==25515==    by 0x30C590654F: __vasprintf_chk (vasprintf_chk.c:80)
==25515==    by 0x4FEDC25: virVasprintfInternal (stdio2.h:210)
==25515==    by 0x4FEDD0B: virAsprintfInternal (virstring.c:482)
==25515==    by 0x4FBCDF5: virFileFindResourceFull (virfile.c:1598)
==25515==    by 0x50D2521: doRemoteOpen (remote_driver.c:867)
==25515==    by 0x50D3A75: remoteConnectOpen (remote_driver.c:1199)
==25515==    by 0x5075D87: do_open (libvirt.c:1147)
==25515==    by 0x507834F: virConnectOpenAuth (libvirt.c:1390)
==25515==    by 0x4CBAD04: guestfs___open_libvirt_connection (libvirt-auth.c:227)
==25515==    by 0x4CB869F: launch_libvirt (launch-libvirt.c:275)
==25515==    by 0x4CB0E16: guestfs__launch (launch.c:93)

Version-Release number of selected component (if applicable):

libvirt-1.2.6-1.fc21.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Run virt-sysprep under valgrind.

Comment 1 Ján Tomko 2014-07-07 06:34:35 UTC
Patch posted:
https://www.redhat.com/archives/libvir-list/2014-July/msg00286.html

Comment 2 Ján Tomko 2014-07-07 06:51:07 UTC
commit f1e192e92ec17f9fe979f1d30bad79f21189eef1
Author:     Ján Tomko <jtomko>
CommitDate: 2014-07-07 08:32:11 +0200

    Free the return value of virFileFindResource
    
    Commits e18a80a and 57e5c3c switched from a getenv wrapper which
    does not allocate a string to virFileFindResource which does not,
    without freeing it.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1116427

git describe: v1.2.6-50-gf1e192e