diff options
author | Hansang Bae <hansang.bae@intel.com> | 2019-05-30 16:32:20 +0000 |
---|---|---|
committer | Hansang Bae <hansang.bae@intel.com> | 2019-05-30 16:32:20 +0000 |
commit | 7c75ac0c60d623c8bbdc1b6d924e4ff85547b9ca (patch) | |
tree | 404f21560ad2d9b736bbc9a40bbfbf739a1bd83d | |
parent | 700fdb10706186a464cc86b8c1fae0cd778a449d (diff) | |
download | bcm5719-llvm-7c75ac0c60d623c8bbdc1b6d924e4ff85547b9ca.tar.gz bcm5719-llvm-7c75ac0c60d623c8bbdc1b6d924e4ff85547b9ca.zip |
Add checks before pointer dereferencing
This change adds checks before dereferencing a pointer returned from a
function.
Differential Revision: https://reviews.llvm.org/D62224
llvm-svn: 362111
-rw-r--r-- | openmp/runtime/src/ompt-specific.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/openmp/runtime/src/ompt-specific.cpp b/openmp/runtime/src/ompt-specific.cpp index 99c4b6118cb..63153d274ef 100644 --- a/openmp/runtime/src/ompt-specific.cpp +++ b/openmp/runtime/src/ompt-specific.cpp @@ -210,7 +210,8 @@ ompt_data_t *__ompt_get_thread_data_internal() { void __ompt_thread_assign_wait_id(void *variable) { kmp_info_t *ti = ompt_get_thread(); - ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t)(uintptr_t)variable; + if (ti) + ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t)(uintptr_t)variable; } int __ompt_get_state_internal(ompt_wait_id_t *omp_wait_id) { @@ -432,6 +433,9 @@ int __ompt_get_task_memory_internal(void **addr, size_t *size, int blocknum) { return 0; // support only a single block kmp_info_t *thr = ompt_get_thread(); + if (!thr) + return 0; + kmp_taskdata_t *taskdata = thr->th.th_current_task; kmp_task_t *task = KMP_TASKDATA_TO_TASK(taskdata); |