[libvirt] [PATCH 4/n] storage: plug memory leak on error

Eric Blake eblake at redhat.com
Wed Nov 24 22:36:19 UTC 2010


On 11/24/2010 03:08 PM, Matthias Bolte wrote:
> 2010/11/24 Eric Blake <eblake at redhat.com>:
>> * src/storage/storage_backend.c
>> (virStorageBackendUpdateVolTargetInfoFD): Avoid leak.
>> ---
>>
>> Unlikely to bite in real life, but still a leak.
>>
>>  src/storage/storage_backend.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
>> index a6ee564..10ea33c 100644
>> --- a/src/storage/storage_backend.c
>> +++ b/src/storage/storage_backend.c
>> @@ -1148,11 +1148,11 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
>>         }
>>     } else {
>>         target->perms.label = strdup(filecon);
>> +        freecon(filecon);
>>         if (target->perms.label == NULL) {
>>             virReportOOMError();
>>             return -1;
>>         }
>> -        freecon(filecon);
>>     }
>>  #else
>>     target->perms.label = NULL;
>> --
>> 1.7.3.2
>>
> 
> ACK.

I've pushed the series through 5/n, although I may continue to extend it
further as I review more valgrind logs (by the way, libnl is a beast for
how frequently it leaks small strings).

Meanwhile, as discussed with Matthew on IRC, I squashed 4 and 5 together
before pushing, since 5 had the better commit message and those are the
only two files to use security_context_t.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list