[PATCH:libX11 07/12] Avoid memory leak/corruption if realloc fails in Xregion.h:MEMCHECK macro

Alan Coopersmith alan.coopersmith at oracle.com
Sun Aug 11 18:08:36 PDT 2013


On 08/11/13 03:37 AM, Matthieu Herrb wrote:
> On Sat, Aug 10, 2013 at 01:55:04PM -0700, Alan Coopersmith wrote:
>> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
>
> I'm wondering here if firstrect() shouldn't be free()'d when Xrealloc
> fails. I can't tell from reading the code what will happen if Xrealloc
> fails (since most of the callers are void functions that don't have a
> way to propagate the error).

 From what I can see (not being that familiar with this code), it always
assumes the rects pointer in the region is a valid pointer to a list of
at least one rectangle, so if we freed it, we'd violate that assumption.

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list