Skip to content

Use emalloc and friends in curl #11231

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
wants to merge 2 commits into from
Closed

Conversation

iluuu1994
Copy link
Member

This avoids memory leaks when bailing in unexpected places (e.g. due to memory limits).

@iluuu1994 iluuu1994 requested a review from adoy as a code owner May 11, 2023 14:29
@iluuu1994 iluuu1994 force-pushed the curl-emalloc branch 2 times, most recently from 5e0a3eb to 7340ba4 Compare May 11, 2023 15:37
This avoids memory leaks when bailing in unexpected places (e.g. due to memory
limits).
Getting NULL pointer errors in efree, not sure why. NULL should be skipped.
@iluuu1994
Copy link
Member Author

Sadly, I don't think this is possible because zend_alloc is not built to be thread-safe...

https://curl.se/libcurl/c/curl_global_init_mem.html

If you are using libcurl from multiple threads or libcurl was built with the threaded resolver option then the callback functions must be thread safe. The threaded resolver is a common build option to enable (and in some cases the default) so we strongly urge you to make your callback functions thread safe.

@iluuu1994 iluuu1994 closed this May 11, 2023
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