diff --git a/sysbench/drivers/mysql/drv_mysql.c b/sysbench/drivers/mysql/drv_mysql.c index a7bc6f0..cda6662 100644 --- a/sysbench/drivers/mysql/drv_mysql.c +++ b/sysbench/drivers/mysql/drv_mysql.c @@ -271,6 +271,7 @@ int mysql_drv_connect(db_conn_t *sb_conn) return 1; sb_conn->ptr = con; + DEBUG("mysql_init(%p)", con); mysql_init(con); pthread_mutex_lock(&hosts_mutex); @@ -280,7 +281,6 @@ int mysql_drv_connect(db_conn_t *sb_conn) host = SB_LIST_ENTRY(hosts_pos, value_t, listitem)->data; pthread_mutex_unlock(&hosts_mutex); - DEBUG("mysql_init(%p)", con); mysql_options(con, MYSQL_READ_DEFAULT_GROUP, "sysbench"); DEBUG("mysql_options(%p, MYSQL_READ_DEFAULT_GROUP, \"sysbench\")", con); diff --git a/sysbench/scripting/script_lua.c b/sysbench/scripting/script_lua.c index b00d466..73e1a0e 100644 --- a/sysbench/scripting/script_lua.c +++ b/sysbench/scripting/script_lua.c @@ -579,7 +579,8 @@ int sb_lua_db_disconnect(lua_State *L) ctxt = sb_lua_get_context(L); - db_disconnect(ctxt->con); + if (ctxt->con) + db_disconnect(ctxt->con); ctxt->con = NULL;