http://bugs.winehq.org/show_bug.cgi?id=18067
Summary: Large blocks not reported properly to valgrind by RtlAllocateHeap Product: Wine Version: 1.1.19 Platform: Other OS/Version: other Status: NEW Keywords: download, patch, source Severity: normal Priority: P2 Component: ntdll AssignedTo: wine-bugs@winehq.org ReportedBy: dank@kegel.com
Found while valgrinding chromium unit tests. Here's a simple test case:
$ cat > foo.c <<_EOF_ #include <malloc.h> int main() { char *p = malloc(1000000); free(p); } _EOF_ $ i586-mingw32msvc-gcc foo.c $ valgrind --trace-children=yes wine a.exe ... ==2953== Invalid free() / delete / delete[] ==2953== at 0x6C80EDF: RtlFreeHeap dlls/ntdll/heap.c:1464
Looks like Eric missed a code path when he first added the valgrind hooks?
http://bugs.winehq.org/show_bug.cgi?id=18067
--- Comment #1 from Dan Kegel dank@kegel.com 2009-04-15 16:37:50 --- Patch sent, http://www.winehq.org/pipermail/wine-patches/2009-April/071894.html
http://bugs.winehq.org/show_bug.cgi?id=18067
--- Comment #2 from Dan Kegel dank@kegel.com 2009-04-16 23:38:47 --- Patch committed, but Rob pointed out a related problem on wine-devel, let's keep this bug open for the moment.
http://bugs.winehq.org/show_bug.cgi?id=18067
--- Comment #3 from Austin English austinenglish@gmail.com 2009-04-17 11:44:32 --- (In reply to comment #2)
Patch committed, but Rob pointed out a related problem on wine-devel, let's keep this bug open for the moment.
http://www.winehq.org/pipermail/wine-devel/2009-April/074890.html
2009/4/15 Dan Kegel <dank at kegel.com>:
Two chromium unit tests reported phony errors when run on wine on valgrind because RtlAllocateHeap sometimes returned an allocation without notifying valgrind about it.
RtlReAllocateHeap is also missing valgrind notifications for the large block paths. It also appears that the function leaks memory in the realloc small -> large path.
http://bugs.winehq.org/show_bug.cgi?id=18067
--- Comment #4 from Dan Kegel dank@kegel.com 2009-04-19 00:37:08 --- I've started on tests for this. (You have to run them under valgrind to get the full effect, but that's ok.)
http://bugs.winehq.org/show_bug.cgi?id=18067
--- Comment #5 from Dan Kegel dank@kegel.com 2009-04-19 21:24:32 --- Sent next patch, http://www.winehq.org/pipermail/wine-patches/2009-April/072007.html I probably won't fix the leak, but at least it has a FIXME now
http://bugs.winehq.org/show_bug.cgi?id=18067
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Large blocks not reported |RtlAllocateHeap leaks memory |properly to valgrind by |in the small->large path |RtlAllocateHeap |
--- Comment #6 from Dan Kegel dank@kegel.com 2009-04-27 10:19:04 --- OK, the rest of the hooks are in, and there's a FIXME comment next to the leak: http://www.winehq.org/pipermail/wine-cvs/2009-April/054932.html
The only part remaining is the memory leak. Changing summary.
http://bugs.winehq.org/show_bug.cgi?id=18067
Chris Humbert winehq@mahadri.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winehq@mahadri.com
--- Comment #7 from Chris Humbert winehq@mahadri.com 2009-05-15 21:43:05 --- *** Bug 18488 has been marked as a duplicate of this bug. ***
http://bugs.winehq.org/show_bug.cgi?id=18067
--- Comment #8 from Austin English austinenglish@gmail.com 2009-05-18 10:20:07 --- Probably fixed by http://source.winehq.org/git/wine.git/?a=commitdiff;h=13a33b73c349530b17347d....
http://bugs.winehq.org/show_bug.cgi?id=18067
--- Comment #9 from Nikolay Sivov bunglehead@gmail.com 2009-10-19 15:30:38 --- (In reply to comment #8)
Probably fixed by http://source.winehq.org/git/wine.git/?a=commitdiff;h=13a33b73c349530b17347d....
Hi, Dan. The last FIXME was fixed with this commit. Is this bug fixed?
http://bugs.winehq.org/show_bug.cgi?id=18067
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #10 from Dan Kegel dank@kegel.com 2009-10-19 15:54:02 --- Probably. I'll know for sure next time I run all the tests.
http://bugs.winehq.org/show_bug.cgi?id=18067
--- Comment #11 from Nikolay Sivov bunglehead@gmail.com 2009-10-19 15:58:13 --- (In reply to comment #10)
Probably. I'll know for sure next time I run all the tests.
Forgot to mention, your example from description doesn't produce any output with RtlFreeHeap() in it - I'm not skilled in valgrind output interpretation, but this word doesn't occur.
http://bugs.winehq.org/show_bug.cgi?id=18067
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #12 from Alexandre Julliard julliard@winehq.org 2009-10-23 13:19:05 --- Closing bugs fixed in 1.1.32.