[libvirt] [PATCH] daemon: Plug memory leak on remoteDispatchAuthList

Eric Blake eblake at redhat.com
Mon Feb 20 14:24:43 UTC 2012


On 02/20/2012 03:05 AM, Alex Jia wrote:
> Detected by valgrind. Leak is introuduced in commit fcdfa31.
> 
> * daemon/remote.c (remoteDispatchAuthList): fix memory leak on failure path.
> 
> * Actual result
> 

> +++ b/daemon/remote.c
> @@ -2054,6 +2054,7 @@ remoteDispatchAuthList(virNetServerPtr server ATTRIBUTE_UNUSED,
>              if (virAsprintf(&ident, "pid:%lld,uid:%d",
>                              (long long) callerPid, callerUid) < 0) {
>                  virReportOOMError();
> +                VIR_FREE(ident);

How can that possibly be fixing the leak?  If virAsprintf returns < 0,
then ident is guaranteed to be NULL, and you have added a no-op statement.

I wouldn't be surprised if there is still a lurking bug here; after all,
my commit 15a280bb was an attempt to solve a valgrind memory leak, which
was then in turn reworked by Jim in commits c05ec920 and fcdfa31f.  But
we need to diagnose and patch the real problem, if this is the case.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120220/16f420f8/attachment-0001.sig>


More information about the libvir-list mailing list