Ooodles of sexy new valgrind warnings

Maarten Lankhorst m.b.lankhorst at gmail.com
Tue May 27 23:51:11 CDT 2008


Hi Dan,

2008/5/26 Dan Kegel <dank at kegel.com>:
> On Mon, May 26, 2008 at 5:15 PM, Maarten Lankhorst
> <m.b.lankhorst at gmail.com> wrote:
>>> + Mismatched free() / delete / delete []
>>> +    at  RtlFreeHeap (heap.c:1287)
>>> +    by  wave_in_test_device (capture.c:397)
>> This particular kind of bug happens when you use a string function
>> like strdup to allocate some memory, then try to free it with
>> HeapFree. The proper fix would be to use HeapAlloc.
>
> Yeah, I just copied what you did with the other one in that DLL the
> other day; see
> http://www.winehq.org/pipermail/wine-patches/2008-May/055219.html
Proactively grepping I also found these:

$ git grep =[\ ]*strdup\(
dinput/joystick_linuxinput.c:        joydev.device = strdup(buf);
dinput/joystick_linuxinput.c:          joydev.name = strdup(buf);
fusion/assembly.c:    *path = strdup(assembly->path);
gphoto2.ds/ds_ctrl.c:   gpfile->folder = strdup(folder);
gphoto2.ds/ds_ctrl.c:   gpfile->filename = strdup(name);
twain_32/dsm_ctrl.c:            devices[nrdevices].modname = strdup(dsname);
wineps.drv/mkagl.c:     glyphs[num_glyphs].name = strdup(namebuf);
wineps.drv/mkagl.c:     glyphs[num_glyphs].comment = strdup(commbuf);
wineps.drv/mkagl.c:         glyphs[num_glyphs].name = strdup(namebuf);
wineps.drv/mkagl.c:         glyphs[num_glyphs].comment = strdup(linebuf);
winex11.drv/opengl.c:    WineGLInfo.glExtensions = strdup((const char
*) pglGetString(GL_EXTENSIONS));

I'll probably take a look tomorrow to see which ones are harmful and
which aren't.

Cheers,
Maarten.



More information about the wine-devel mailing list