Skip to content

Simplify php_openssl_load_all_certs_from_file()#21430

Open
botovq wants to merge 1 commit intophp:masterfrom
botovq:load_all_certs_from_file
Open

Simplify php_openssl_load_all_certs_from_file()#21430
botovq wants to merge 1 commit intophp:masterfrom
botovq:load_all_certs_from_file

Conversation

@botovq
Copy link

@botovq botovq commented Mar 13, 2026

Correctly free both stacks, sk and stack, in the exit path and transfer ownership of stack to ret on success. Don't free the members of sk in the loop, only steal the certs after successful sk_X509_push(), which is error checked as it always should be. Switch from sk_new_reserve() back to the much saner sk_X509_new_null(). This makes ownership in this code easier to reason about and more robust to future modifications.

Alternative to #21418

Correctly free both stacks, sk and stack, in the exit path and transfer
ownership of stack to ret on success. Don't free the members of sk
in the loop, only steal the certs after successful sk_X509_push(), which
is error checked as it always should be. Switch from sk_new_reserve()
back to the much saner sk_X509_new_null(). This makes ownership in this
code easier to reason about and more robust to future modifications.
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.

1 participant