Fix leak closing 'query.stmt' in case of 'async_free_result' called for 'ASYNC_STMT_PREPARE_FAILED' state #3525

pull/3544/head
Javier Jaramago Fernández 5 years ago
parent 4013b0afdc
commit de2fd24e77

@ -2145,6 +2145,15 @@ void MySQL_Connection::async_free_result() {
mysql_stmt_free_result(query.stmt);
}
}
// If we reached here from 'ASYNC_STMT_PREPARE_FAILED', the
// prepared statement was never added to 'local_stmts', thus
// it will never be freed when 'local_stmts' are purged. If
// initialized, it must be freed. For more context see #3525.
if (this->async_state_machine == ASYNC_STMT_PREPARE_FAILED) {
if (query.stmt != NULL) {
mysql_stmt_close(query.stmt);
}
}
query.stmt=NULL;
}
if (mysql_result) {

Loading…
Cancel
Save