[libvirt] [PATCH] libxl: Fix double-dispose of libxl domain config

libxlBuildDomainConfig() was disposing the libxl_domain_config object on error, only to have it disposed again by libxlBuildDomainConfig()'s caller, which resulted in a segfault. Leave disposing of the config object to it's owner. --- src/libxl/libxl_conf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 7e0753a..3de642b 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -796,19 +796,19 @@ libxlBuildDomainConfig(libxlDriverPrivatePtr driver, return -1; if (libxlMakeDomBuildInfo(def, d_config) < 0) { - goto error; + return -1; } if (libxlMakeDiskList(def, d_config) < 0) { - goto error; + return -1; } if (libxlMakeNicList(def, d_config) < 0) { - goto error; + return -1; } if (libxlMakeVfbList(driver, def, d_config) < 0) { - goto error; + return -1; } d_config->on_reboot = def->onReboot; @@ -816,8 +816,4 @@ libxlBuildDomainConfig(libxlDriverPrivatePtr driver, d_config->on_crash = def->onCrash; return 0; - -error: - libxl_domain_config_dispose(d_config); - return -1; } -- 1.8.0.1

On 04/29/2013 05:20 PM, Jim Fehlig wrote:
libxlBuildDomainConfig() was disposing the libxl_domain_config object on error, only to have it disposed again by libxlBuildDomainConfig()'s caller, which resulted in a segfault. Leave disposing of the config object to it's owner. --- src/libxl/libxl_conf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Eric Blake wrote:
On 04/29/2013 05:20 PM, Jim Fehlig wrote:
libxlBuildDomainConfig() was disposing the libxl_domain_config object on error, only to have it disposed again by libxlBuildDomainConfig()'s caller, which resulted in a segfault. Leave disposing of the config object to it's owner. --- src/libxl/libxl_conf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
ACK.
Thanks, pushed for 1.0.5 since it's strictly a bug fix. Regards, Jim
participants (2)
-
Eric Blake
-
Jim Fehlig