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>
This commit is contained in:
Tiago Vignatti 2011-04-04 20:25:32 +03:00
parent 81414c1c83
commit 82498e3c2c

View File

@ -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