[PATCH] mshtml: check for NULL return from allocations

Jacek Caban jacek at codeweavers.com
Tue Dec 1 17:02:29 CST 2009


Hi Marcus,

Marcus Meissner wrote:
> Hi,
>
> Coverity thinks we miss NULL checks and yes, we do.
> Added some.
>
>   
(...)
>  
> -    wstrbuf_init(&buf);
> +    if (!wstrbuf_init(&buf))
> +        return E_OUTOFMEMORY;
>      range_to_string(This, &buf);
> -    if(buf.buf)
> -        *p = SysAllocString(buf.buf);
> +    *p = SysAllocString(buf.buf);
>      wstrbuf_finish(&buf);
>  
>      TRACE("ret %s\n", debugstr_w(*p));
> +    if (!*p)
> +        return E_OUTOFMEMORY;
>      return S_OK;
>  }

This check is not meant to check allocation failure, but to check if range_to_string set it to NULL. We even have a tests for this. More error handling is a good thing to do, but this check should remain unchanged.


Thanks,
	Jacek 





More information about the wine-devel mailing list