Commit 105cd471 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ulrich Sibiller

Avoid memory leak/corruption if realloc fails in Xregion.h:MEMCHECK macro

parent 180991ce
......@@ -113,10 +113,11 @@ typedef struct _XRegion {
*/
#define MEMCHECK(reg, rect, firstrect){\
if ((reg)->numRects >= ((reg)->size - 1)){\
(firstrect) = (BOX *) Xrealloc \
((char *)(firstrect), (unsigned) (2 * (sizeof(BOX)) * ((reg)->size)));\
if ((firstrect) == 0)\
BoxPtr tmpRect = Xrealloc ((firstrect), \
(2 * (sizeof(BOX)) * ((reg)->size))); \
if (tmpRect == NULL) \
return(0);\
(firstrect) = tmpRect; \
(reg)->size *= 2;\
(rect) = &(firstrect)[(reg)->numRects];\
}\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment