On 05/20/2013 02:46 AM, Ján Tomko wrote:
>> -    if (prog[0] != NULL) {
>> -        ADD_ARG_LIT("--save");
>> -        if (virRun(prog, NULL) < 0) {
>> +    if (cmd) {
> 
> cmd may be NULL here on OOM too.

That, and virCommandRun is designed to report OOM on your behalf if cmd
is NULL, so that your client code shouldn't have to worry about whether
virCommandNew... even succeeded.  Code that does 'if (cmd)' is generally
suspect as doing too much instead of letting virCommand do its job.

-- 
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
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to