mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
libxl: Avoid possible use of uninitialized mem in libxlDomainStart
The 'libxl_domain_config' object is stack allocated which means its memory contents are undefined. The libxl_domain_config_dispose() call is only safe if the memory is initialized to a defined state. Not all code paths which reach libxl_domain_config_dispose() will ensure that libxl_domain_config_init() is called. Move the libxl_domain_config_init() call earlier in the function to ensure all codepaths have defined memory state. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
3bab69c30f
commit
10a99a6d13
@ -1100,6 +1100,8 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
|
|||||||
#endif
|
#endif
|
||||||
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
|
virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
|
||||||
|
|
||||||
|
libxl_domain_config_init(&d_config);
|
||||||
|
|
||||||
if (libxlDomainObjPrivateInitCtx(vm) < 0)
|
if (libxlDomainObjPrivateInitCtx(vm) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -1149,8 +1151,6 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
|
|||||||
VIR_FREE(managed_save_path);
|
VIR_FREE(managed_save_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
libxl_domain_config_init(&d_config);
|
|
||||||
|
|
||||||
if (libxlBuildDomainConfig(driver->reservedVNCPorts, vm->def,
|
if (libxlBuildDomainConfig(driver->reservedVNCPorts, vm->def,
|
||||||
priv->ctx, &d_config) < 0)
|
priv->ctx, &d_config) < 0)
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
Loading…
Reference in New Issue
Block a user