Skip to content

prevent double free in WRITEFUNCTION_BUF#111

Merged
nojb merged 1 commit intoygrek:masterfrom
lukepalmer:master
Aug 1, 2025
Merged

prevent double free in WRITEFUNCTION_BUF#111
nojb merged 1 commit intoygrek:masterfrom
lukepalmer:master

Conversation

@lukepalmer
Copy link
Copy Markdown
Contributor

This change fixes a potential double free in the writefunction_buf callback.

The bug is that an argument of NULL to caml_ba_alloc_dims will result in allocation even if CAML_BA_EXTERNAL is specified. We then set ba->data to a pointer managed by libcurl. This can cause both libcurl and the ocaml runtime to potentially later attempt to free this pointer.

Copy link
Copy Markdown
Collaborator

@nojb nojb left a comment

Choose a reason for hiding this comment

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

Well spotted.

LGTM

@lukepalmer
Copy link
Copy Markdown
Contributor Author

Could this be merged please? I have another PR behind it.

@nojb nojb merged commit 6ee195a into ygrek:master Aug 1, 2025
4 of 5 checks passed
@nojb
Copy link
Copy Markdown
Collaborator

nojb commented Aug 1, 2025

Hello, apologies for the lag (holiday season...)

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