DynamoRIO / DynamoRIO/drmemory
Memory leaks below LoadLibrary
- Dominant language
- C
- Stars
- 2.7k
- Forks
- 290
- PR merge metrics
- No merged PRs in 30d
Description
_From [timurrrr@google.com](https://code.google.com/u/timurrrr@google.com/) on June 21, 2011 08:49:43_
According to MSDN, http://msdn.microsoft.com/en-us/library/ms684175(v=vs.85).aspx "The system maintains a per-process reference count on all loaded modules. Calling LoadLibrary increments the reference count. Calling the FreeLibrary or FreeLibraryAndExitThread function decrements the reference count. The system unloads a module when its reference count reaches zero or when the process terminates (regardless of the reference count)."
If I got it right, there shouldn't be memory leaks below LoadLibrary (or they are benign).
However, Dr. Memory prints out memory leaks below LoadLibrary, e.g. on the issue #462 code:
Error `#4`: LEAK 128 direct bytes 0x007329b0-0x00732a30 + 0 indirect bytes
0x0062ade8 msvcrt.dll!towlower
0x0062ae43 msvcrt.dll!towlower
0x00632015 msvcrt.dll!initterm_e
0x00631fc8 msvcrt.dll!initterm_e
0x00631a94 msvcrt.dll!_crtLCMapStringA
0x0062a48c msvcrt.dll!lock
0x77449960 ntdll.dll!RtlQueryEnvironmentVariable
0x7744d8c9 ntdll.dll!LdrResSearchResource
0x7744d78c ntdll.dll!LdrResSearchResource
0x7744c4e5 ntdll.dll!LdrLoadDll
0x75161d2a KERNELBASE.dll!LoadLibraryExW
0x75161d7a KERNELBASE.dll!LoadLibraryExA
0x76da4bf7 KERNEL32.dll!LoadLibraryA
0x0040102b test.exe!main
c:\sandbox\uuid_create\test.cpp:7
_Original issue: http://code.google.com/p/drmemory/issues/detail?id=463_
Contributor guide
Assessment
This issue has not been assessed yet.