Re: [PATCH 2/9] openvz: Convert virExec usage to virCommand

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

 



On 05/13/2011 04:47 PM, Eric Blake wrote:
> On 05/13/2011 02:10 PM, Cole Robinson wrote:
>> v2:
>>     Use virCommand's autocleanup
>>
>> Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
>> ---
>>  src/openvz/openvz_conf.c   |   37 +++++++++--------------------
>>  src/openvz/openvz_driver.c |   55 +++++++++++++++++++++++--------------------
>>  2 files changed, 41 insertions(+), 51 deletions(-)
> 
>> @@ -1446,18 +1445,22 @@ static int openvzListDefinedDomains(virConnectPtr conn ATTRIBUTE_UNUSED,
>>          }
>>          got ++;
>>      }
>> -    waitpid(pid, NULL, 0);
>> +
>> +    if (virCommandWait(cmd, NULL) < 0)
>> +        goto out;
>> +
>>      if (VIR_CLOSE(outfd) < 0) {
>>          virReportSystemError(errno, "%s", _("failed to close file"));
>>          goto out;
>>      }
>> -    return got;
>>  
>> +    rc = got;
>>  out:
>>      VIR_FORCE_CLOSE(outfd);
>> +    virCommandFree(cmd);
>>      for ( ; got >= 0 ; got--)
>>          VIR_FREE(names[got]);
> 
> Oops, this now frees names[] on success.  You need to gate this for loop
> on whether rc >= 0, now that the success path falls through to the out
> label.
> 
> ACK with that nit fixed.
> 

Thanks, pushed with that fix.

- Cole

--
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]