[Libvir] PATCH: 9/16: main internal storage driver

Daniel P. Berrange berrange at redhat.com
Mon Feb 18 15:47:36 UTC 2008


On Mon, Feb 18, 2008 at 10:25:04AM +0100, Jim Meyering wrote:
> "Daniel P. Berrange" <berrange at redhat.com> wrote:
> ...
> > diff -r 77cf7f42edd4 src/storage_conf.c
> > --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> > +++ b/src/storage_conf.c	Thu Feb 07 12:59:40 2008 -0500
> ...
> > +    if (options->flags & VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE) {
> > +        xmlNodePtr *nodeset = NULL;
> > +        int nsource, i;
> > +
> > +        if ((nsource = virXPathNodeSet("/pool/source/device", ctxt, &nodeset)) <= 0) {
> > +            virStorageReportError(conn, VIR_ERR_XML_ERROR, "cannot extract source devices");
> > +            goto cleanup;
> > +        }
> > +        if ((ret->source.devices = calloc(nsource, sizeof(*ret->source.devices))) == NULL) {
> > +            free(nodeset);
> > +            virStorageReportError(conn, VIR_ERR_NO_MEMORY, "device");
> > +            goto cleanup;
> > +        }
> > +        for (i = 0 ; i < nsource ; i++) {
> > +            xmlChar *path = xmlGetProp(nodeset[i], BAD_CAST "path");
> > +            if (path == NULL) {
> > +                virStorageReportError(conn, VIR_ERR_XML_ERROR, "missing source device path");
> 
> It looks like you need to free nodeset here, too.

Yes, thanks

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list