summaryrefslogtreecommitdiff
path: root/Xext/xvmain.c
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2016-03-01 21:39:01 +0100
committerAdam Jackson <ajax@redhat.com>2016-03-02 10:03:29 -0500
commit939ce0bae68b682b57675f65c901653c1a094ebb (patch)
tree5a18976eb4f49d2b7ada55d93f4e3bb47a0ba56a /Xext/xvmain.c
parent05e1bcf56e1c511a1ef539acfe11e37727e1179e (diff)
xv: fix double free in AddResource failure case
XvdiDestroyVideoNotifyList already frees the list if AddResource fails, so don't do it twice. And set tpn->client to NULL explicitly to avoid confusing uninitialized memory with a valid value. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Julien Cristau <jcristau@debian.org>
Diffstat (limited to 'Xext/xvmain.c')
-rw-r--r--Xext/xvmain.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 3a0263427..c9b11d4bb 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -800,10 +800,9 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
return BadAlloc;
tpn->next = NULL;
- if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) {
- free(tpn);
+ tpn->client = NULL;
+ if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
return BadAlloc;
- }
}
else {
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */