[PATCH:libX11 09/12] Region.c: ensure region size is updated correctly if realloc fails

Alan Coopersmith alan.coopersmith at oracle.com
Sun Aug 11 18:14:06 PDT 2013


On 08/11/13 05:21 AM, Matthieu Herrb wrote:
> On Sat, Aug 10, 2013 at 01:55:06PM -0700, Alan Coopersmith wrote:
>> Don't want later users of the function to think there's more or less
>> memory allocated than there really is.
>>
>> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
>
> For this one and the next one, I also wonder what happens in practice
> if realloc fails. Can the application really continue with the smaller
> than needed buffer ?

In the miRegionOp case here, it's actually a larger than needed buffer
that it was trying to shrink after determining it now had space for
more than twice as many rectangles as it's currently storing there, so
it should be hard for it to fail (unless we screwed up the math), and
okay to continue if it does.

In the miRegionCopy case, like the previous patch, maybe we need to start
propagating errors instead of just assuming they never happen (which
they must not very much, since I don't remember many bug reports here).

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


More information about the xorg-devel mailing list