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

Re: [libvirt] [PATCHv2 2/2] sysinfo: convert to virCommand



On 12/13/2010 04:10 PM, Matthias Bolte wrote:
> 2010/12/7 Eric Blake <eblake redhat com>:
>> * src/util/sysinfo.c (virSysinfoRead): Use virCommand instead of
>> virExec.
>> ---
>> v2: remove unused variable, rebase on top of whitespace cleanups.

>>     path = virFindFileInPath(SYSINFO_SMBIOS_DECODER);
>>     if (path == NULL) {

allocated...

>> @@ -108,43 +106,13 @@ virSysinfoRead(void) {
>>                              SYSINFO_SMBIOS_DECODER);
>>         return NULL;
>>     }
>> -    argv[0] = path;

the old code freed it as part of argv cleanups

>>
>> -    res = virExec(argv, NULL, NULL, &pid, -1, &outfd, &errfd,
>> -                  VIR_EXEC_NONE | VIR_EXEC_NONBLOCK);
>> -    if (res < 0) {
>> +    cmd = virCommandNewArgList(path, "-q", "-t", "0,1", NULL);

oh, you're right - the new code strdup's it, so I did leak it.

>>  cleanup:
>>     VIR_FREE(outbuf);
>> -    VIR_FREE(errbuf);
>> -    VIR_FREE(path);
>> +    virCommandFree(cmd);
> 
> Why not free path anymore, doesn't it leak now?
> 
> ACK, with that possible leak addressed.

I've restored the VIR_FREE(path).

Thanks for the review, and pushed.

-- 
Eric Blake   eblake redhat com    +1-801-349-2682
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]