Repository navigation
Conversation
…ails odbc_prepare() set conn_ptr before describing the parameters but registered the result in conn->results only afterwards. When SQLDescribeParam() failed, the error branch freed param_info, then the object destructor freed it again in odbc_result_free() and deleted index 0 from conn->results, unregistering whichever live result held that slot. Register the result as soon as conn_ptr is set, as the other result-producing functions do, and release it through odbc_result_free() on failure. Fixes phpGH-25036
Owner
Author
|
Promoted upstream: php#25044 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When SQLDescribeParam() failed, odbc_prepare() freed param_info and the result's destructor freed it again, also deleting index 0 from conn->results, a slot the result never owned. The result is now registered as soon as conn_ptr is set, like every other function that creates an Odbc\Result, and released through odbc_result_free() on failure.
Reported against the Windows {SQL Server} driver; reproduced and verified on Linux with psqlodbc and PostgreSQL 16, not against SQL Server.
Fixes php#25036