Skip to content
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

Fixed GH-18247: dba_popen() memory leak on invalid path. #18250

Closed
wants to merge 1 commit into from

Conversation

devnexen
Copy link
Member

@devnexen devnexen commented Apr 4, 2025

and a handful more error code paths.

@devnexen devnexen marked this pull request as ready for review April 4, 2025 21:01
@devnexen devnexen requested a review from Girgias as a code owner April 4, 2025 21:01
ext/dba/dba.c Outdated
Comment on lines 865 to 868
if (!connection->info->lock.fp) {
/* stream operation already wrote an error message */
efree(resource_key);
zend_string_release_ex(connection->hash, persistent);
dba_close_info(connection->info);
connection->info = NULL;
zval_ptr_dtor(return_value);
RETURN_FALSE;
}
Copy link
Member

Choose a reason for hiding this comment

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

Might be better to add a label at the end of the function for cleanup and goto there. As this is prone to be forgotten.

ext/dba/dba.c Outdated
Comment on lines 894 to 898
efree(resource_key);
zend_string_release_ex(connection->hash, persistent);
dba_close_info(connection->info);
connection->info = NULL;
zval_ptr_dtor(return_value);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
efree(resource_key);
zend_string_release_ex(connection->hash, persistent);
dba_close_info(connection->info);
connection->info = NULL;
zval_ptr_dtor(return_value);
goto fail

and a handful more error code paths.
@devnexen devnexen closed this in fed948d Apr 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants