emilk / loguru

A lightweight C++ logging library
The Unlicense
1.79k stars 260 forks source link

fix strdup memory leak #99

Closed HaochengLIU closed 5 years ago

HaochengLIU commented 5 years ago

Hi, would you please review this PR? It fixes a memory leak we found in our nightly asan build. Thanks!

emilk commented 5 years ago

pthread_setspecific stores the pointer given to it, not the values pointed to by the pointer. With your code s_pthread_key_name will be left pointing to freed memory. Previous discussion here: https://github.com/emilk/loguru/issues/59