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

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

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
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]