miPolyPoint bugfix: Check memory allocation before changing the GC.
miPolyPoint ought to leave the GC unchanged even if it fails. ajax says: > We have a new winner for the oldest-bug competition! It's actually > been like that since X11R1: > > -rw-r--r--. 1 ajax ajax 2817 1987-09-12 01:20 ddx/mi/mipolypnt.c Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
ccdaecc547
commit
4080cd42fd
|
@ -73,6 +73,9 @@ miPolyPoint(
|
||||||
int i;
|
int i;
|
||||||
xPoint *ppt;
|
xPoint *ppt;
|
||||||
|
|
||||||
|
if(!(pwidthInit = xalloc(npt * sizeof(int))))
|
||||||
|
return;
|
||||||
|
|
||||||
/* make pointlist origin relative */
|
/* make pointlist origin relative */
|
||||||
if (mode == CoordModePrevious)
|
if (mode == CoordModePrevious)
|
||||||
{
|
{
|
||||||
|
@ -107,8 +110,6 @@ miPolyPoint(
|
||||||
DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
|
DoChangeGC(pGC, GCFillStyle, &fsNew, 0);
|
||||||
ValidateGC(pDrawable, pGC);
|
ValidateGC(pDrawable, pGC);
|
||||||
}
|
}
|
||||||
if(!(pwidthInit = xalloc(npt * sizeof(int))))
|
|
||||||
return;
|
|
||||||
pwidth = pwidthInit;
|
pwidth = pwidthInit;
|
||||||
for(i = 0; i < npt; i++)
|
for(i = 0; i < npt; i++)
|
||||||
*pwidth++ = 1;
|
*pwidth++ = 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user