[OMPT] Adding missing free() calls to ompt_tool_windows() function.

llvm-svn: 251719
This commit is contained in:
Jonathan Peyton 2015-10-30 20:24:25 +00:00
parent 1543bdf450
commit 57d171c9a6
1 changed files with 4 additions and 0 deletions

View File

@ -137,6 +137,7 @@ ompt_initialize_t ompt_tool_windows()
if( !EnumProcessModules( process, modules, NUM_MODULES * sizeof(HMODULE),
&needed ) ) {
// Regardless of the error reason use the stub initialization function
free(modules);
return NULL;
}
// Check if NUM_MODULES is enough to list all modules
@ -148,6 +149,7 @@ ompt_initialize_t ompt_tool_windows()
modules = (HMODULE*)realloc( modules, needed );
// If resizing failed use the stub function.
if( !EnumProcessModules( process, modules, needed, &needed ) ) {
free(modules);
return NULL;
}
}
@ -160,6 +162,7 @@ ompt_initialize_t ompt_tool_windows()
printf("ompt_tool_windows(): ompt_tool found in module %s\n",
modName);
#endif
free(modules);
return ompt_tool_p();
}
#if OMPT_DEBUG
@ -171,6 +174,7 @@ ompt_initialize_t ompt_tool_windows()
}
#endif
}
free(modules);
return NULL;
}
#else