From 72a8498e0881a5480c66d950ffa77cd44c3b65fa Mon Sep 17 00:00:00 2001 From: Jonathan Peyton Date: Thu, 16 Jun 2016 20:14:54 +0000 Subject: [PATCH] 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 llvm-svn: 272946 --- openmp/runtime/src/kmp_affinity.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp index b6e77a63f4f6..6f4c7c1910bb 100644 --- a/openmp/runtime/src/kmp_affinity.cpp +++ b/openmp/runtime/src/kmp_affinity.cpp @@ -414,6 +414,7 @@ __kmp_affinity_create_hwloc_map(AddrUnsPair **address2os, 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(AddrUnsPair **address2os, } if (__kmp_affinity_type == affinity_none) { + __kmp_free(retval); KMP_CPU_FREE(oldMask); return 0; }