[PATCH] xf86xvmc: Once hooked into CloseScreen, defer the free after init errors

Chris Wilson chris at chris-wilson.co.uk
Sun May 15 08:19:13 PDT 2011


After hooking ourselves into the CloseScreen callback, we will attempt
to double-free pAdapt if we free it upon a failure to initialise the
XvMC adaptor and then during CloseScreen. Rather than rearrange the code
to only hook ourselves into CloseScreen, or to disentangle the callback
along a failure path, just defer the free until the end.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 hw/xfree86/common/xf86xvmc.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c
index e6464a5..f9249fb 100644
--- a/hw/xfree86/common/xf86xvmc.c
+++ b/hw/xfree86/common/xf86xvmc.c
@@ -199,7 +199,6 @@ Bool xf86XvMCScreenInit(
 	}
 	if(!pAdapt[i].xv_adaptor) {
 	    /* no adaptor by that name */
-	    free(pAdapt);
 	    return FALSE;
 	}
 	pAdapt[i].num_surfaces = (*adaptors)->num_surfaces;
-- 
1.7.5.1



More information about the xorg-devel mailing list