jscript: Don't release possible NULL pointer (coverity)

Jacek Caban jacek at codeweavers.com
Thu Oct 18 10:41:23 CDT 2012


Hi André,

On 10/18/12 00:14, André Hentschel wrote:
> CID 735258
>
> ---
>  dlls/jscript/regexp.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/dlls/jscript/regexp.c b/dlls/jscript/regexp.c
> index bdff445..71474c7 100644
> --- a/dlls/jscript/regexp.c
> +++ b/dlls/jscript/regexp.c
> @@ -3378,7 +3378,9 @@ static HRESULT do_regexp_match_next(script_ctx_t *ctx, RegExpInstance *regexp, D
>          last_match = jsstr_alloc_len(str, len);
>          if(!last_match)
>              return E_OUTOFMEMORY;
> -        jsstr_release(ctx->last_match);
> +
> +        if(ctx->last_match)
> +            jsstr_release(ctx->last_match);
>          ctx->last_match = last_match;

ctx->last_match should always be a valid string. I guess coverity is
confused by earlier compare to NULL, which is a leftover after string
representation change. We should use jsstr_t here to avoid allocation
anyway, I will send a patch.

Thanks,
Jacek



More information about the wine-devel mailing list