From 4b02f3b2b6bf0f186a293e44753c30492584aad0 Mon Sep 17 00:00:00 2001 From: kwasimensah Date: Wed, 1 Nov 2017 13:26:00 -0400 Subject: [PATCH] Updated to use gpr_free and gpr_malloc --- src/core/lib/support/cpu_posix.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/lib/support/cpu_posix.cc b/src/core/lib/support/cpu_posix.cc index c32ca4659c7..2be66ef54ea 100644 --- a/src/core/lib/support/cpu_posix.cc +++ b/src/core/lib/support/cpu_posix.cc @@ -27,6 +27,7 @@ #include +#include #include #include #include @@ -56,7 +57,7 @@ unsigned gpr_cpu_current_cpu(void) { static auto DeleteValue = [](void *value_ptr) { unsigned int *value = static_cast(value_ptr); if (value) { - delete value; + gpr_free(value); } }; static pthread_key_t thread_id_key; @@ -69,7 +70,8 @@ unsigned gpr_cpu_current_cpu(void) { unsigned int *thread_id = static_cast(pthread_getspecific(thread_id_key)); if (thread_id == nullptr) { - thread_id = new unsigned int(thread_counter++); + thread_id = static_cast(gpr_malloc(sizeof(unsigned int))); + *thread_id = thread_counter++; pthread_setspecific(thread_id_key, thread_id); }