Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/mysqlnd/mysqlnd_ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,7 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_stmt, close_on_server)(MYSQLND_STMT * const s, bo
MYSQLND_STMT_DATA * stmt = s? s->data : NULL;
MYSQLND_CONN_DATA * conn = stmt? stmt->conn : NULL;
enum_mysqlnd_collected_stats statistic = STAT_LAST;
enum_func_status ret = PASS;

DBG_ENTER("mysqlnd_stmt::close_on_server");
if (!stmt || !conn) {
Expand Down Expand Up @@ -1789,13 +1790,12 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_stmt, close_on_server)(MYSQLND_STMT * const s, bo
STAT_FREE_RESULT_EXPLICIT);

if (GET_CONNECTION_STATE(&conn->state) == CONN_READY) {
enum_func_status ret = FAIL;
const size_t stmt_id = stmt->stmt_id;

ret = conn->command->stmt_close(conn, stmt_id);
if (ret == FAIL) {
COPY_CLIENT_ERROR(stmt->error_info, *conn->error_info);
DBG_RETURN(FAIL);
/* Don't return early - continue with cleanup to prevent memory leaks */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do not return early here, won’t this end up returning PASS?

It introduces a bit of code duplication, but how about adding the cleanup logic here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this better now?

}
}
}
Expand Down Expand Up @@ -1825,7 +1825,7 @@ MYSQLND_METHOD_PRIVATE(mysqlnd_stmt, close_on_server)(MYSQLND_STMT * const s, bo
stmt->conn = NULL;
}

DBG_RETURN(PASS);
DBG_RETURN(ret);
}
/* }}} */

Expand Down
Loading