SpiraMirabilis/stunt

mysql_close() sometimes does not completely close a connection

Closed this issue · 1 comments

The builtin mysql_close sometimes does not completely close a MySQL connection. It will zero out the id and other info for the connection, but not destroy/free it. This is a reminder for me to fix it this weekend. I think it is due to this if statement in bf_mysql_close:

if (mysql_connection_status(wrapper) != 0) {
    do_mysql_disconnect(wrapper); <--- the function to destroy/free mysql wrappers is called here.
    wrapper->conn = (MYSQL*)0;
    r.v.num = 1;
}

I haven't been able to reproduce this bug on demand, but I think thats because it only happens on 'stale' MySQL connections that sometimes get killed from the server's end. Need to either remove the free from do_mysql_disconnect or add an else statement there.