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 <[email protected]>
---
 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

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to