[Libvir] PATCH: Fix crash in cleanup when VM creation fails

Daniel Veillard veillard at redhat.com
Tue Jul 24 07:23:42 UTC 2007


On Mon, Jul 23, 2007 at 08:55:52PM +0100, Daniel P. Berrange wrote:
> If using the 'virDomainCreateLinux' call to create a VM, a so called 
> 'transient' domain will be created - ie one without any config file.
> There is special code in the qemudShutdownVMDaemon method to cleanup
> the resources associated with such domains, in particuarly free'ing 
> the struct qemud_vm  object. Unfortunately in the virDomainCreateLinux
> codepath this is a problem, because we still need the 'struct qemud_vm'
> object in certain edge cases, and so the caller has to free it. We
> currently have a double free() in that scenario. This patch removes
> the call to qemudFreeVMDaemon from qemudShutdownVMDaemon. Instead it
> is now always the caller's responsibility to cleanup after transient
> domains.

  I think a bit weird that a routine which may still fail in some
way can be switched back from returning an int to void and still
generate an improvement. The way we used the return value of Shutdown
is not needed anymore but I wonder about the possibility of other error
case.

   +1 for the fix still, that's important
   Related bug is
     https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=249072
for those wondering.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list