From 6e5cda6a52c1b63d741cbe5aa8736441424580e4 Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Fri, 15 Oct 2010 12:27:52 -0700 Subject: [PATCH] avoid potential race-condition with closing a connection --- ext/mysql2/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/mysql2/client.c b/ext/mysql2/client.c index 8680521..fdf55cd 100644 --- a/ext/mysql2/client.c +++ b/ext/mysql2/client.c @@ -142,8 +142,8 @@ static void rb_mysql_client_free(void * ptr) { static VALUE nogvl_close(void * ptr) { mysql_client_wrapper *wrapper = ptr; if (!wrapper->closed) { - mysql_close(wrapper->client); wrapper->closed = 1; + mysql_close(wrapper->client); if (!wrapper->freed) { free(wrapper->client); }