Re: [PATCH 1/5] conf: avoid memleak on NULL path

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

 



On 04/07/2014 02:22 AM, Peter Krempa wrote:
> On 04/06/14 05:32, Eric Blake wrote:
>> I noticed that the apparmor code could request metadata even
>> for a cdrom with no media, which would cause a memory leak of
>> the hash table used to look for loops in the backing chain.
>> But even before that, we blindly dereferenced the path for
>> printing a debug statement, so it is just better to enforce
>> that this is only used on non-NULL names.
>>

>> +++ b/src/util/virstoragefile.c
>> @@ -1142,9 +1142,9 @@ virStorageFileGetMetadata(const char *path, int format,
>>                path, format, (int)uid, (int)gid, allow_probe);
>>
>>      virHashTablePtr cycle = virHashCreate(5, NULL);
>> -    virStorageFileMetadataPtr ret;
>> +    virStorageFileMetadataPtr ret = NULL;
> 
> This assignment will always be overwritten or unused.

Leftovers from a different approach I had tried.  I dropped this change...

> 
>>
>> -    if (!cycle || !path)
>> +    if (!cycle)
>>          return NULL;
>>
>>      if (format <= VIR_STORAGE_FILE_NONE)
> 
> ACK,

and pushed.

-- 
Eric Blake   eblake redhat com    +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]