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