mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-09 04:58:06 +02:00
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>
(cherry picked from commit 939ce0bae6)
This commit is contained in:
parent
90b854b2ac
commit
23d9b2a566
1 changed files with 2 additions and 3 deletions
|
|
@ -800,10 +800,9 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
||||||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
tpn->next = NULL;
|
tpn->next = NULL;
|
||||||
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) {
|
tpn->client = NULL;
|
||||||
free(tpn);
|
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */
|
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue