[Openmp-commits] [openmp] r272946 - Fixed missing memory cleanup in __kmp_affinity_create_hwloc_map()

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 16 13:14:54 PDT 2016


Author: jlpeyton
Date: Thu Jun 16 15:14:54 2016
New Revision: 272946

URL: http://llvm.org/viewvc/llvm-project?rev=272946&view=rev
Log:
Fixed missing memory cleanup in __kmp_affinity_create_hwloc_map()

Cleanup: fixed missing memory cleanup in couple of corner cases. Fixes possible
memory leak in some corner cases

Patch by Andrey Churbanov

Differential Revision: http://reviews.llvm.org/D21355

Modified:
    openmp/trunk/runtime/src/kmp_affinity.cpp

Modified: openmp/trunk/runtime/src/kmp_affinity.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_affinity.cpp?rev=272946&r1=272945&r2=272946&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_affinity.cpp (original)
+++ openmp/trunk/runtime/src/kmp_affinity.cpp Thu Jun 16 15:14:54 2016
@@ -414,6 +414,7 @@ __kmp_affinity_create_hwloc_map(AddrUnsP
             KMP_INFORM(Topology, "KMP_AFFINITY", nPackages, nCoresPerPkg,
               __kmp_nThreadsPerCore, __kmp_ncores);
         }
+        KMP_CPU_FREE(oldMask);
         return 0;
     }
 
@@ -562,6 +563,7 @@ __kmp_affinity_create_hwloc_map(AddrUnsP
     }
 
     if (__kmp_affinity_type == affinity_none) {
+        __kmp_free(retval);
         KMP_CPU_FREE(oldMask);
         return 0;
     }




More information about the Openmp-commits mailing list