xvmc: Fix unchecked AddResource
Reviewed-by: Rémi Cardona <remi@gentoo.org> Signed-off-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
parent
a2c3c34b44
commit
119d5c0e2f
17
Xext/xvmc.c
17
Xext/xvmc.c
|
@ -253,6 +253,10 @@ ProcXvMCCreateContext(ClientPtr client)
|
||||||
free(pContext);
|
free(pContext);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (!AddResource(pContext->context_id, XvMCRTContext, pContext)) {
|
||||||
|
free(data);
|
||||||
|
return BadAlloc;
|
||||||
|
}
|
||||||
|
|
||||||
rep = (xvmcCreateContextReply) {
|
rep = (xvmcCreateContextReply) {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
|
@ -266,7 +270,6 @@ ProcXvMCCreateContext(ClientPtr client)
|
||||||
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
|
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
|
||||||
if (dwords)
|
if (dwords)
|
||||||
WriteToClient(client, dwords << 2, data);
|
WriteToClient(client, dwords << 2, data);
|
||||||
AddResource(pContext->context_id, XvMCRTContext, pContext);
|
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
|
@ -329,6 +332,11 @@ ProcXvMCCreateSurface(ClientPtr client)
|
||||||
free(pSurface);
|
free(pSurface);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (!AddResource(pSurface->surface_id, XvMCRTSurface, pSurface)) {
|
||||||
|
free(data);
|
||||||
|
return BadAlloc;
|
||||||
|
}
|
||||||
|
|
||||||
rep = (xvmcCreateSurfaceReply) {
|
rep = (xvmcCreateSurfaceReply) {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
@ -338,7 +346,6 @@ ProcXvMCCreateSurface(ClientPtr client)
|
||||||
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
|
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
|
||||||
if (dwords)
|
if (dwords)
|
||||||
WriteToClient(client, dwords << 2, data);
|
WriteToClient(client, dwords << 2, data);
|
||||||
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
|
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
|
@ -445,6 +452,11 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
||||||
free(pSubpicture);
|
free(pSubpicture);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (!AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture)) {
|
||||||
|
free(data);
|
||||||
|
return BadAlloc;
|
||||||
|
}
|
||||||
|
|
||||||
rep = (xvmcCreateSubpictureReply) {
|
rep = (xvmcCreateSubpictureReply) {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
@ -462,7 +474,6 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
||||||
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
|
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
|
||||||
if (dwords)
|
if (dwords)
|
||||||
WriteToClient(client, dwords << 2, data);
|
WriteToClient(client, dwords << 2, data);
|
||||||
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
|
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue