Skip to content

Fixed error reporting in mysqli_stmt::__construct #6454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

kamil-tekiela
Copy link
Member

No description provided.


if (statement) {
if (mysql_stmt_prepare(stmt->stmt, statement, statement_len)) {
MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
Copy link
Member

Choose a reason for hiding this comment

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

Needs an efree(stmt) afterwards?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand why. I copied this from mysqli_stmt_prepare and there is no efree there. Besides I don't think that method allocates memory that I would need to deallocate myself. Can you explain it to me please?

Copy link
Member

Choose a reason for hiding this comment

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

Because this is the funcion that allocates stmt (line 993). It will only be placed inside a resource below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Now I get it. I think I fixed it but can you please check if it is correct now?

@kamil-tekiela kamil-tekiela force-pushed the finish-mysqli_stmt-constructor branch 3 times, most recently from f00e85d to 328838c Compare November 25, 2020 12:06
@kamil-tekiela kamil-tekiela force-pushed the finish-mysqli_stmt-constructor branch from 328838c to c551242 Compare November 25, 2020 12:06
@php-pulls php-pulls closed this in 233f507 Nov 25, 2020
@kamil-tekiela kamil-tekiela deleted the finish-mysqli_stmt-constructor branch December 2, 2020 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants