[PATCH 2/3] gdiplus: Set outer pointer to NULL when image loading functions fail.

Dmitry Timoshkov dmitry at baikal.ru
Sat Mar 1 20:50:22 CST 2014


Qian Hong <qhong at codeweavers.com> wrote:

> @@ -1365,10 +1365,12 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromFile(GDIPCONST WCHAR* filename,
>      if(!filename || !bitmap)
>          return InvalidParameter;
>  
> +    *bitmap = NULL;

Is there an application that depends on this behaviour?

>      stat = GdipCreateStreamOnFile(filename, GENERIC_READ, &stream);
>  
>      if(stat != Ok)
> -        return stat;
> +        return InvalidParameter;

Probably GdipCreateStreamOnFile should be fixed instead (with tests
of course).

>  
>      stat = GdipCreateBitmapFromStream(stream, bitmap);
>  
> @@ -2923,10 +2925,12 @@ GpStatus WINGDIPAPI GdipLoadImageFromFile(GDIPCONST WCHAR* filename,
>      if (!filename || !image)
>          return InvalidParameter;
>  
> +    *image = NULL;

Same question as above.

>      stat = GdipCreateStreamOnFile(filename, GENERIC_READ, &stream);
>  
>      if (stat != Ok)
> -        return stat;
> +        return OutOfMemory;

Same note about GdipCreateStreamOnFile. And I don't think that's a good
idea to replicate weird return error codes without actually getting any
memory allocation errors.

-- 
Dmitry.



More information about the wine-devel mailing list