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

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

 



On 12/13/2010 04:10 PM, Matthias Bolte wrote:
> 2010/12/7 Eric Blake <eblake@xxxxxxxxxx>:
>> * 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@xxxxxxxxxx    +1-801-349-2682
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]