[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [PATCH 2/2] jscript: Fixed a leak in regexp_match function
From:       Piotr Caban <piotr.caban () gmail ! com>
Date:       2013-01-25 15:52:06
Message-ID: 5102AA26.9040705 () gmail ! com
[Download RAW message or body]

On 01/25/13 16:30, Marcus Meissner wrote:
> On Fri, Jan 25, 2013 at 04:26:59PM +0100, Piotr Caban wrote:
> > @@ -3466,10 +3466,15 @@ static HRESULT regexp_match(script_ctx_t *ctx, jsdisp_t \
> > *dispex, jsstr_t *str, B break;
> > 
> > if(ret_size == i) {
> > -            if(ret)
> > -                ret = heap_realloc(ret, (ret_size <<= 1) * \
> >                 sizeof(match_result_t));
> > -            else
> > +            if(ret) {
> > +                match_result_t *old_ret = ret;
> > +
> > +                ret = heap_realloc(old_ret, (ret_size <<= 1) * \
> > sizeof(match_result_t)); +                if(!ret)
> > +                    heap_free(old_ret);
> 
> Should be probably if (ret) heap_free(old_ret);  here.
I think it's correct. I want to free old buffer in case of HeapRealloc 
error.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic