comctl32: realloc or free and alloc
Alexey Fisher
bug-track at fisher-privat.net
Sun May 1 04:07:27 CDT 2011
On So, 2011-05-01 at 07:43 +0200, Alexey Fisher wrote:
> Am Samstag, den 30.04.2011, 14:41 +0000 schrieb Dan Kegel:
> > Alexey wrote:
> >
> > > i currently digg in comctl32 to find why my app fails. I found that
> > > string conversation AtoW in some places silently fails. The problem is
> > > that the destination for string is just a fresh pointer (not NULL).
> > > Str_SetPtrAtoW check if it is NULL pointer and if not it trys to
> > > ReAlloc. There was no Alloc before so ReAlloc returns NULL
> >
> > 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.
>
> > Your proposed solution would pass a non-Alloc'd
> > pointer to Free, which doesn't seem good.
>
> So probably best solution is to forbid using not a NULL pointer in this
> func. The programmer should decide where to Free it before.
>
There is a new patch in the attachment.
--
Regards,
Alexey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine_str.diff
Type: text/x-patch
Size: 3815 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20110501/36f54617/attachment.bin>
More information about the wine-devel
mailing list