• Monty's avatar
    Fix for memory leak in applications, like QT,that calls · 5c9baf54
    Monty authored
    my_thread_global_init() + my_thrad_global_end() repeatadily.
    This caused THR_KEY_mysys to be allocated multiple times.
    
    Deletion of THR_KEY_mysys was originally in my_thread_global_end() but was
    moved to my_end() as DBUG uses THR_KEY_mysys and DBUG is released after
    my_thread_global_end() is called.
    
    Releasing DBUG before my_thread_global_end() and move THR_KEY_mysys back
    into my_thread_global_end() could be a solution, but as safe_mutex and other
    things called by my_thread_global_end is using DBUG it may not be completely
    safe.
    
    To solve this, I used the simple solution to add a marker that THR_KEY_mysys
    is created and not re-create it in my_thread_global_init if it already
    exists.
    5c9baf54
my_thr_init.c 13.9 KB