Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 610958 Details for
Bug 846602
MySQL C API missing THR_KEY_mysys
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Fix mysql C connector TLS memory leak
fix-mysql-connector.diff (text/plain), 2.31 KB, created by
Stephane Carrez
on 2012-09-08 09:36:57 UTC
(
hide
)
Description:
Fix mysql C connector TLS memory leak
Filename:
MIME Type:
Creator:
Stephane Carrez
Created:
2012-09-08 09:36:57 UTC
Size:
2.31 KB
patch
obsolete
>--- mysql-connector-c-6.0.2/mysys/my_thr_init.c.orig 2009-08-07 14:31:12.000000000 +0200 >+++ mysql-connector-c-6.0.2/mysys/my_thr_init.c 2012-09-07 21:37:39.840742330 +0200 >@@ -47,6 +47,7 @@ pthread_mutexattr_t my_fast_mutexattr; > #ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP > pthread_mutexattr_t my_errorcheck_mutexattr; > #endif >+static void thread_cleanup(void* data); > #ifdef _MSC_VER > static void install_sigabrt_handler(); > #endif >@@ -118,7 +119,7 @@ my_bool my_thread_global_init(void) > int pth_ret; > thd_lib_detected= get_thread_lib(); > >- if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0) >+ if ((pth_ret= pthread_key_create(&THR_KEY_mysys, thread_cleanup)) != 0) > { > fprintf(stderr,"Can't initialize threads: error %d\n", pth_ret); > return 1; >@@ -256,9 +257,9 @@ void my_thread_global_end(void) > > void my_thread_destroy_mutex(void) > { >+#ifdef SAFE_MUTEX > struct st_my_thread_var *tmp; > tmp= my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys); >-#ifdef SAFE_MUTEX > if (tmp) > { > safe_mutex_free_deadlock_data(&tmp->mutex); >@@ -377,6 +378,20 @@ void my_thread_end(void) > fprintf(stderr,"my_thread_end(): tmp: 0x%lx pthread_self: 0x%lx thread_id: %ld\n", > (long) tmp, (long) pthread_self(), tmp ? (long) tmp->id : 0L); > #endif >+ pthread_setspecific(THR_KEY_mysys,0); >+ >+ /* Cleanup using the Posix 1003.1 standard mechanism with pthread_key_create */ >+ thread_cleanup(tmp); >+} >+ >+/* >+ Do the real thread memory cleanup. This is called explictly by >+ my_thread_end() or by the Posix 1003.1 thread cleanup mechanism. >+*/ >+static void thread_cleanup(void* data) >+{ >+ struct st_my_thread_var *tmp = (struct st_my_thread_var*) data; >+ > if (tmp && tmp->init) > { > >@@ -404,7 +419,7 @@ void my_thread_end(void) > bfill(tmp, sizeof(tmp), 0x8F); > #endif > free(tmp); >- pthread_setspecific(THR_KEY_mysys,0); >+ > /* > Decrement counter for number of running threads. We are using this > in my_thread_global_end() to wait until all threads have called >@@ -415,11 +430,7 @@ void my_thread_end(void) > DBUG_ASSERT(THR_thread_count != 0); > if (--THR_thread_count == 0) > pthread_cond_signal(&THR_COND_threads); >- pthread_mutex_unlock(&THR_LOCK_threads); >- } >- else >- { >- pthread_setspecific(THR_KEY_mysys,0); >+ pthread_mutex_unlock(&THR_LOCK_threads); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 846602
: 610958