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

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



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 redhat com>
>> ---
>>  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


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