diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-05-08 09:41:46 -0700 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-05-18 14:43:27 +1000 |
commit | 4bcc0448b42b06ec133886ccb4f029b57b6f2b3e (patch) | |
tree | f5a39e14ddd4f9ff0e91dff2167b9be27b21556f | |
parent | c1e6e7ea968f86f61fd1bfdf4764c57be2a93605 (diff) |
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>
(cherry picked from commit 4080cd42fde8b4c693eab7557581af2622479109)
-rw-r--r-- | mi/mipolypnt.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mi/mipolypnt.c b/mi/mipolypnt.c index 5d6243ab0..12771ee4e 100644 --- a/mi/mipolypnt.c +++ b/mi/mipolypnt.c @@ -73,6 +73,9 @@ miPolyPoint( int i; xPoint *ppt; + if(!(pwidthInit = xalloc(npt * sizeof(int)))) + return; + /* make pointlist origin relative */ if (mode == CoordModePrevious) { @@ -107,8 +110,6 @@ miPolyPoint( DoChangeGC(pGC, GCFillStyle, &fsNew, 0); ValidateGC(pDrawable, pGC); } - if(!(pwidthInit = xalloc(npt * sizeof(int)))) - return; pwidth = pwidthInit; for(i = 0; i < npt; i++) *pwidth++ = 1; |