From 82498e3c2cce6f515063ecb4b6ae9303e828da00 Mon Sep 17 00:00:00 2001 From: Tiago Vignatti Date: Mon, 4 Apr 2011 20:25:32 +0300 Subject: [PATCH] xfree86: xv: set pointers to NULL in xf86XVFreeAdaptor As a good practice and for eventual double frees. The reason of this patch is due the resilience of xf86XVInitAdaptors, where for any adaptor failure it's able to keep trying registering the following ones. I discussed briefly with Pauli and Ville about a bigger refactoring of such function, doing it in a way to return instantly when a failure happens; after all that's how mostly of the other driver functions work. Instead, we just thought that xf86XVInitAdaptors is wise and cool, and eventually other driver functions should be even following the main idea of resilience. Signed-off-by: Tiago Vignatti Reviewed-by: Jeremy Huddleston --- hw/xfree86/common/xf86xv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index f87af4c73..b46dfefed 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -313,6 +313,7 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor) int i; free(pAdaptor->name); + pAdaptor->name = NULL; if(pAdaptor->pEncodings) { XvEncodingPtr pEncode = pAdaptor->pEncodings; @@ -320,9 +321,11 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor) for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) free(pEncode->name); free(pAdaptor->pEncodings); + pAdaptor->pEncodings = NULL; } free(pAdaptor->pFormats); + pAdaptor->pFormats = NULL; if(pAdaptor->pPorts) { XvPortPtr pPort = pAdaptor->pPorts; @@ -341,6 +344,7 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor) } } free(pAdaptor->pPorts); + pAdaptor->pPorts = NULL; } if(pAdaptor->pAttributes) { @@ -354,6 +358,8 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor) free(pAdaptor->pImages); free(pAdaptor->devPriv.ptr); + pAdaptor->pImages = NULL; + pAdaptor->devPriv.ptr = NULL; } static Bool