summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2011-04-04 20:25:32 +0300
committerTiago Vignatti <tiago.vignatti@nokia.com>2011-04-07 19:57:08 +0300
commit82498e3c2cce6f515063ecb4b6ae9303e828da00 (patch)
tree22f74a9e8ba428f8c2fae432c2bd4ee2efdc9c6b
parent81414c1c836ae30628606545edbf7392d9b3d009 (diff)
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 <tiago.vignatti@nokia.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--hw/xfree86/common/xf86xv.c6
1 files changed, 6 insertions, 0 deletions
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