[PATCH] render: Propagate allocation failure from createSourcePicture()

Jeremy Huddleston jeremyhu at apple.com
Sun Dec 18 16:59:39 PST 2011


On Dec 14, 2011, at 10:52, Chris Wilson wrote:

> On Wed, 14 Dec 2011 19:37:26 +0100, Julien Cristau <jcristau at debian.org> wrote:
>> On Wed, Dec 14, 2011 at 15:55:22 +0000, Chris Wilson wrote:
>> 
>>> All the callers were already checking for failure, except that
>>> createSourcePicture() itself was failing to check whether it
>>> successfully allocated the Picture.
>>> 
>>> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
>>> ---
>>> render/picture.c |    4 ++++
>>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>> 
>>> diff --git a/render/picture.c b/render/picture.c
>>> index f134596..165ceac 100644
>>> --- a/render/picture.c
>>> +++ b/render/picture.c
>>> @@ -848,7 +848,11 @@ static void initGradient(SourcePictPtr pGradient, int stopCount,
>>> static PicturePtr createSourcePicture(void)
>>> {
>>>     PicturePtr pPicture;
>>> +
>>>     pPicture = dixAllocateObjectWithPrivates(PictureRec, PRIVATE_PICTURE);
>>> +    if (!pPicture)
>>> +	return 0;
>>> +
>> 
>> make that return NULL?
> 
> The rest of the file uses 0 for its NULL pointer, and this was just cut
> and paste from CreatePicture()...

Yeah... ok...

Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

But there really should be a followup changing all those 0s to NULLs.




More information about the xorg-devel mailing list