[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]