DynamoRIO / DynamoRIO/drmemory

Uninits and leaks when using CoInitialize/CoCreateInstance

Open
#425 3 comments 0 reactions 0 assignees View on GitHub
Bug-FalsePositive Migrated OpSys-Windows Priority-Low
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 May 30, 2011 06:06:33_

As of r313 ,
#

#include

#include
#include
#include

#pragma comment(lib, "ole32.lib")

int main() {
::CoInitialize(NULL);

```
IShellLink* obj;
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID*)&obj);
if (!SUCCEEDED(hres)) {
::CoUninitialize();
printf("FAIL\n");
return 1;
}
// For more tests see http://msdn.microsoft.com/en-us/library/bb776891(v=vs.85).aspx#Shellink_Creating_Shortcut obj->Release();

::CoUninitialize();
printf("PASS\n");
return 0;
```

}
#

Gives the following reports (besides known false positives):

Error `#7`: UNINITIALIZED READ: reading 0x001672e0-0x001672e1 1 byte(s)
@0:00:05.344 in thread 16412
0x76fda30f CLBCatQ.DLL!DestroyStgDatabase
0x76fd7178 CLBCatQ.DLL!PostError
0x76fd7132 CLBCatQ.DLL!PostError
0x76fd6d24 CLBCatQ.DLL!PostError
0x76fd73d4 CLBCatQ.DLL!PostError
0x76fd6c72 CLBCatQ.DLL!PostError
0x76fd74c8 CLBCatQ.DLL!PostError
0x76fd308f CLBCatQ.DLL!?
0x7c90118a ntdll.dll!LdrInitializeThunk
0x7c9224ca ntdll.dll!RtlDestroyEnvironment
0x7c81caae KERNEL32.dll!IsValidLocale
0x7c81cb26 KERNEL32.dll!ExitProcess

Error `#8`: UNINITIALIZED READ: reading 0x00167424-0x00167425 1 byte(s)
@0:00:05.391 in thread 16412
0x76fda30f CLBCatQ.DLL!DestroyStgDatabase
0x76fd7132 CLBCatQ.DLL!PostError
0x76fd6d24 CLBCatQ.DLL!PostError
0x76fd73d4 CLBCatQ.DLL!PostError
0x76fd6c72 CLBCatQ.DLL!PostError
0x76fd74c8 CLBCatQ.DLL!PostError
0x76fd308f CLBCatQ.DLL!?
0x7c90118a ntdll.dll!LdrInitializeThunk
0x7c9224ca ntdll.dll!RtlDestroyEnvironment
0x7c81caae KERNEL32.dll!IsValidLocale
0x7c81cb26 KERNEL32.dll!ExitProcess
0x00402aa2 test.exe!__crtExitProcess

_Original issue: http://code.google.com/p/drmemory/issues/detail?id=425_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.