Re: PATCH: 9/16: main internal storage driver

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

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> 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");

Hi Dan,

It looks like you need to free nodeset here, too.

> +                goto cleanup;
> +            }
> +            ret->source.devices[i].path = (char *)path;
> +        }
> +        free(nodeset);
> +        ret->source.ndevice = nsource;
> +    }
> +    if (options->flags & VIR_STORAGE_BACKEND_POOL_SOURCE_DIR) {
> +        if ((ret->source.dir = virXPathString("string(/pool/source/dir/@path)", ctxt)) == NULL) {
> +            virStorageReportError(conn, VIR_ERR_XML_ERROR, "missing source path");
> +            goto cleanup;
> +        }
> +    }

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