--*/
BOOL
-PROCBuildCreateDumpCommandLine(const char** argv, char* dumpName, char* dumpType, BOOL diag)
+PROCBuildCreateDumpCommandLine(
+ const char** argv,
+ char** pprogram,
+ char** ppidarg,
+ char* dumpName,
+ char* dumpType,
+ BOOL diag)
{
if (g_szCoreCLRPath == nullptr)
{
}
const char* DumpGeneratorName = "createdump";
int programLen = strlen(g_szCoreCLRPath) + strlen(DumpGeneratorName) + 1;
- char* program = (char*)InternalMalloc(programLen);
+ char* program = *pprogram = (char*)InternalMalloc(programLen);
if (program == nullptr)
{
return FALSE;
{
return FALSE;
}
- char* pidarg = (char*)InternalMalloc(128);
+ char* pidarg = *ppidarg = (char*)InternalMalloc(128);
if (pidarg == nullptr)
{
return FALSE;
char* dumpType = getenv("COMPlus_DbgMiniDumpType");
char* diagStr = getenv("COMPlus_CreateDumpDiagnostics");
BOOL diag = diagStr != nullptr && strcmp(diagStr, "1") == 0;
+ char* program = nullptr;
+ char* pidarg = nullptr;
- if (!PROCBuildCreateDumpCommandLine((const char **)g_argvCreateDump, dumpName, dumpType, diag))
+ if (!PROCBuildCreateDumpCommandLine((const char **)g_argvCreateDump, &program, &pidarg, dumpName, dumpType, diag))
{
return FALSE;
}
{
return FALSE;
}
- if (dumpName != nullptr && dumpName[0] == '\0')
- {
- dumpName = nullptr;
- }
if (_itoa_s(dumpType, dumpTypeStr, sizeof(dumpTypeStr), 10) != 0)
{
return FALSE;
}
- if (!PROCBuildCreateDumpCommandLine((const char **)argvCreateDump, (char*)dumpName, dumpTypeStr, diag))
+ if (dumpName != nullptr && dumpName[0] == '\0')
{
- return FALSE;
+ dumpName = nullptr;
}
- return PROCCreateCrashDump(argvCreateDump);
+ char* program = nullptr;
+ char* pidarg = nullptr;
+ BOOL result = PROCBuildCreateDumpCommandLine((const char **)argvCreateDump, &program, &pidarg, (char*)dumpName, dumpTypeStr, diag);
+ if (result)
+ {
+ result = PROCCreateCrashDump(argvCreateDump);
+ }
+ free(program);
+ free(pidarg);
+ return result;
}
/*++