Add a sanity check in mysql_free_result (NULLpointerexception)