From: Simon Horman Subject: [rfc 03/18] ioemu: vslots needs to be freed on error in power_off_php_slot() Date: Tue, 17 Feb 2009 20:07:51 +1100 Message-ID: <20090217091545.402153060@vergenet.net> References: <20090217090748.580007796@vergenet.net> Return-path: Content-Disposition: inline; filename=ioemu-vslots-leak.patch List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Ian Jackson List-Id: xen-devel@lists.xenproject.org Signed-off-by: Simon Horman Index: ioemu-remote/hw/pass-through.c =================================================================== --- ioemu-remote.orig/hw/pass-through.c 2009-02-17 17:28:10.000000000 +0900 +++ ioemu-remote/hw/pass-through.c 2009-02-17 17:28:11.000000000 +0900 @@ -3356,7 +3356,7 @@ int power_off_php_slot(int php_slot) int pt_init(PCIBus *e_bus, const char *direct_pci) { - int seg, b, d, f, php_slot = 0; + int seg, b, d, f, php_slot = 0, status = -1; struct pt_dev *pt_dev; struct pci_access *pci_access; char *vslots; @@ -3400,8 +3400,7 @@ int pt_init(PCIBus *e_bus, const char *d if ( pt_dev == NULL ) { PT_LOG("Error: Registration failed (%02x:%02x.%x)\n", b, d, f); - free(direct_pci_head); - return -1; + goto err; } /* Record the virtual slot info */ @@ -3420,10 +3419,11 @@ int pt_init(PCIBus *e_bus, const char *d /* Write virtual slots info to xenstore for Control panel use */ xenstore_write_vslots(vslots); + status = 0; +err: qemu_free(vslots); free(direct_pci_head); - /* Success */ - return 0; + return status; } -- -- Simon Horman VA Linux Systems Japan K.K., Sydney, Australia Satellite Office H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en