comctl32: realloc or free and alloc

Alexey Fisher bug-track at fisher-privat.net
Sun May 1 11:29:59 CDT 2011


On So, 2011-05-01 at 08:05 -0700, Dan Kegel wrote:
> On Sun, May 1, 2011 at 2:07 AM, Alexey Fisher
> <bug-track at fisher-privat.net> wrote:
> >> > The code looks like it assumes that pointer is always
> >> > managed by Alloc/ReAlloc/Free.  In what context is
> >> > the destination a fresh, non-Alloc'd pointer?
> >> > Perhaps that's where the bug lies.
> >>
> >> We do not need to save anything what was in the target. Even the old
> >> code ReAloocate it and then rewrite. In most contexts the pointer is a
> >> fresh one. If it is not, it should be freed before this func.
> 
> I don't see why we should need to change the contract
> so much.   Re-using existing blocks of memory isn't
> the worst idea in the world.

Probably not, but:
Correct me if I'm wrong. You can't ReAlloc pointer only if you allocated
the memory by Alloc. At least for glibc. 

> > There is a new patch in the attachment.
> 
> It seems there's still some mystery in the code,
> and that you don't fully understand it, so your
> patch probably isn't right.

you right.

I'll continue to digg and send new patch ASAP.

-- 
Regards,
        Alexey




More information about the wine-devel mailing list