Xext: Fix a memory leak

Based on: https://patchwork.freedesktop.org/patch/85636/

Rewritten to also free the resources allocated by
panoramix_setup_ids().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Emi Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Hans de Goede 2016-09-23 14:06:52 +03:00 committed by Adam Jackson
parent 3abf791ab8
commit 220d327ee0

View File

@ -991,7 +991,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess); RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess);
if (result != Success) { if (result != Success) {
pDraw->pScreen->DestroyPixmap(pMap); pDraw->pScreen->DestroyPixmap(pMap);
return result; break;
} }
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc); dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
shmdesc->refcnt++; shmdesc->refcnt++;
@ -1008,7 +1008,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
} }
} }
if (result == BadAlloc) { if (result != Success) {
while (j--) while (j--)
FreeResource(newPix->info[j].id, RT_NONE); FreeResource(newPix->info[j].id, RT_NONE);
free(newPix); free(newPix);