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

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

 



Hello Eric,
As you said, it's impossible to fix this leak by my change, 
and from codes point of view, the failure path hasn't any
memory leak. I suspect valgrind gave a incorrect report, 
and I will check it later.

Thanks for your comment,
Alex


----- Original Message -----
From: "Eric Blake" <eblake@xxxxxxxxxx>
To: "Alex Jia" <ajia@xxxxxxxxxx>
Cc: libvir-list@xxxxxxxxxx
Sent: Monday, February 20, 2012 10:24:43 PM
Subject: Re:  [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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]