diff options
Diffstat (limited to 'main/utils.c')
-rw-r--r-- | main/utils.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/main/utils.c b/main/utils.c index d1736e93e..1ea837109 100644 --- a/main/utils.c +++ b/main/utils.c @@ -999,18 +999,7 @@ static void *dummy_start(void *data) #ifdef DEBUG_THREADS struct thr_lock_info *lock_info; pthread_mutexattr_t mutex_attr; -#endif - - /* note that even though data->name is a pointer to allocated memory, - we are not freeing it here because ast_register_thread is going to - keep a copy of the pointer and then ast_unregister_thread will - free the memory - */ - ast_free(data); - ast_register_thread(a.name); - pthread_cleanup_push(ast_unregister_thread, (void *) pthread_self()); -#ifdef DEBUG_THREADS if (!(lock_info = ast_threadstorage_get(&thread_lock_info, sizeof(*lock_info)))) return NULL; @@ -1027,6 +1016,15 @@ static void *dummy_start(void *data) pthread_mutex_unlock(&lock_infos_lock.mutex); /* Intentionally not the wrapper */ #endif /* DEBUG_THREADS */ + /* note that even though data->name is a pointer to allocated memory, + we are not freeing it here because ast_register_thread is going to + keep a copy of the pointer and then ast_unregister_thread will + free the memory + */ + ast_free(data); + ast_register_thread(a.name); + pthread_cleanup_push(ast_unregister_thread, (void *) pthread_self()); + ret = a.start_routine(a.data); pthread_cleanup_pop(1); |