diff --git a/ext/mysql2/mysql2_ext.c b/ext/mysql2/mysql2_ext.c index 181d6fc..3441b04 100644 --- a/ext/mysql2/mysql2_ext.c +++ b/ext/mysql2/mysql2_ext.c @@ -88,7 +88,9 @@ static void rb_mysql_client_free(void * ptr) { } static VALUE nogvl_close(void * ptr) { - mysql_close((MYSQL *)ptr); + MYSQL *client = (MYSQL *)ptr; + mysql_close(client); + client->net.fd = -1; return Qnil; }