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