[Openmp-commits] [openmp] 1611e54 - [OpenMP] libomp: cleanup some resource leaks
via Openmp-commits
openmp-commits at lists.llvm.org
Sat Feb 20 12:28:08 PST 2021
Author: AndreyChurbanov
Date: 2021-02-20T23:27:37+03:00
New Revision: 1611e5473c5e30e0eea9ec5bd187ed455bdd6109
URL: https://github.com/llvm/llvm-project/commit/1611e5473c5e30e0eea9ec5bd187ed455bdd6109
DIFF: https://github.com/llvm/llvm-project/commit/1611e5473c5e30e0eea9ec5bd187ed455bdd6109.diff
LOG: [OpenMP] libomp: cleanup some resource leaks
Close mutexattr and condattr local objects to eliminate resource leaks.
Differential Revision: https://reviews.llvm.org/D96892
Added:
Modified:
openmp/runtime/src/z_Linux_util.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp
index bb6d6c874525..4efde5c5591a 100644
--- a/openmp/runtime/src/z_Linux_util.cpp
+++ b/openmp/runtime/src/z_Linux_util.cpp
@@ -1909,10 +1909,14 @@ void __kmp_runtime_initialize(void) {
KMP_CHECK_SYSFAIL("pthread_mutexattr_init", status);
status = pthread_mutex_init(&__kmp_wait_mx.m_mutex, &mutex_attr);
KMP_CHECK_SYSFAIL("pthread_mutex_init", status);
+ status = pthread_mutexattr_destroy(&mutex_attr);
+ KMP_CHECK_SYSFAIL("pthread_mutexattr_destroy", status);
status = pthread_condattr_init(&cond_attr);
KMP_CHECK_SYSFAIL("pthread_condattr_init", status);
status = pthread_cond_init(&__kmp_wait_cv.c_cond, &cond_attr);
KMP_CHECK_SYSFAIL("pthread_cond_init", status);
+ status = pthread_condattr_destroy(&cond_attr);
+ KMP_CHECK_SYSFAIL("pthread_condattr_destroy", status);
#if USE_ITT_BUILD
__kmp_itt_initialize();
#endif /* USE_ITT_BUILD */
More information about the Openmp-commits
mailing list