From: Laine Stump Date: Mon, 27 Feb 2012 10:52:29 +0000 (-0500) Subject: libxl: eliminate memory leak in libxmlDomainModifyDeviceFlags X-Git-Tag: v0.9.11-rc1~198 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3207de308d7a9ac2655d9651985d463ea7288c6e;p=thirdparty%2Flibvirt.git libxl: eliminate memory leak in libxmlDomainModifyDeviceFlags This call to virDomainDeviceDefParse is both unnecessary (since it will again be called at the top of the immediately following if(), and if not there, then at the top of the if following that), but it also creates a leak of one virDomainDeviceDef and one [whatever type of device the DeviceDef is pointing to; probably a virDomainDiskDef] in the case that the function has been called with VIR_DOMAIN_DEVICE_MODIFY_CONFIG (the second parse will overwrite the devicedef that was just created). --- diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 6db33c25e0..d5fa64a87d 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3243,10 +3243,6 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml, goto cleanup; } - if (!(dev = virDomainDeviceDefParse(driver->caps, vm->def, xml, - VIR_DOMAIN_XML_INACTIVE))) - goto cleanup; - priv = vm->privateData; if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {