[PATCH 1/4] Fix pixmap double-frees on error paths.
Jamey Sharp
jamey at minilop.net
Fri Sep 17 09:01:42 PDT 2010
Commit by Jamey Sharp and Josh Triplett.
Signed-off-by: Jamey Sharp <jamey at minilop.net>
Signed-off-by: Josh Triplett <josh at joshtriplett.org>
---
Xext/shm.c | 6 +-----
dix/dispatch.c | 1 -
2 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/Xext/shm.c b/Xext/shm.c
index 7c218c4..28e1130 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -823,7 +823,6 @@ CreatePmap:
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id;
if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) {
- (*pScreen->DestroyPixmap)(pMap);
result = BadAlloc;
break;
}
@@ -834,10 +833,8 @@ CreatePmap:
}
if(result == BadAlloc) {
- while(j--) {
- (*pScreen->DestroyPixmap)(pMap);
+ while(j--)
FreeResource(newPix->info[j].id, RT_NONE);
- }
free(newPix);
} else
AddResource(stuff->pid, XRT_PIXMAP, newPix);
@@ -1165,7 +1162,6 @@ CreatePmap:
{
return Success;
}
- pDraw->pScreen->DestroyPixmap(pMap);
}
return BadAlloc;
}
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 012ca69..30aa415 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1428,7 +1428,6 @@ CreatePmap:
}
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
return Success;
- (*pDraw->pScreen->DestroyPixmap)(pMap);
}
return BadAlloc;
}
--
1.7.0
More information about the xorg-devel
mailing list