[Openmp-commits] [openmp] r251719 - [OMPT] Adding missing free() calls to ompt_tool_windows() function.

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Fri Oct 30 13:24:25 PDT 2015


Author: jlpeyton
Date: Fri Oct 30 15:24:25 2015
New Revision: 251719

URL: http://llvm.org/viewvc/llvm-project?rev=251719&view=rev
Log:
[OMPT] Adding missing free() calls to ompt_tool_windows() function.

Modified:
    openmp/trunk/runtime/src/ompt-general.c

Modified: openmp/trunk/runtime/src/ompt-general.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/ompt-general.c?rev=251719&r1=251718&r2=251719&view=diff
==============================================================================
--- openmp/trunk/runtime/src/ompt-general.c (original)
+++ openmp/trunk/runtime/src/ompt-general.c Fri Oct 30 15:24:25 2015
@@ -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




More information about the Openmp-commits mailing list