avoid potential race-condition with closing a connection

This commit is contained in:
Brian Lopez 2010-10-15 12:27:52 -07:00
parent 832eb2d247
commit 6e5cda6a52

View File

@ -142,8 +142,8 @@ static void rb_mysql_client_free(void * ptr) {
static VALUE nogvl_close(void * ptr) { static VALUE nogvl_close(void * ptr) {
mysql_client_wrapper *wrapper = ptr; mysql_client_wrapper *wrapper = ptr;
if (!wrapper->closed) { if (!wrapper->closed) {
mysql_close(wrapper->client);
wrapper->closed = 1; wrapper->closed = 1;
mysql_close(wrapper->client);
if (!wrapper->freed) { if (!wrapper->freed) {
free(wrapper->client); free(wrapper->client);
} }