diff --git a/lib/libc_r/uthread/uthread_spec.c b/lib/libc_r/uthread/uthread_spec.c index 745a14509b9e..8558dff85980 100644 --- a/lib/libc_r/uthread/uthread_spec.c +++ b/lib/libc_r/uthread/uthread_spec.c @@ -119,10 +119,12 @@ _thread_cleanupspecific(void) destructor(data); } else { free(_thread_run->specific_data); + _thread_run->specific_data = NULL; return; } } } + _thread_run->specific_data = NULL; free(_thread_run->specific_data); } diff --git a/lib/libkse/thread/thr_spec.c b/lib/libkse/thread/thr_spec.c index 745a14509b9e..8558dff85980 100644 --- a/lib/libkse/thread/thr_spec.c +++ b/lib/libkse/thread/thr_spec.c @@ -119,10 +119,12 @@ _thread_cleanupspecific(void) destructor(data); } else { free(_thread_run->specific_data); + _thread_run->specific_data = NULL; return; } } } + _thread_run->specific_data = NULL; free(_thread_run->specific_data); } diff --git a/lib/libpthread/thread/thr_spec.c b/lib/libpthread/thread/thr_spec.c index 745a14509b9e..8558dff85980 100644 --- a/lib/libpthread/thread/thr_spec.c +++ b/lib/libpthread/thread/thr_spec.c @@ -119,10 +119,12 @@ _thread_cleanupspecific(void) destructor(data); } else { free(_thread_run->specific_data); + _thread_run->specific_data = NULL; return; } } } + _thread_run->specific_data = NULL; free(_thread_run->specific_data); }