Skip to content

Fix libcurl related memory leak#43

Open
sch-m wants to merge 1 commit intopivasoftware:masterfrom
TDT-AG:pr/20210113-fix-mem-leak
Open

Fix libcurl related memory leak#43
sch-m wants to merge 1 commit intopivasoftware:masterfrom
TDT-AG:pr/20210113-fix-mem-leak

Conversation

@sch-m
Copy link
Copy Markdown

@sch-m sch-m commented Jan 13, 2021

Calling curl_global_init() and curl_global_cleanup() on every
http_client_init() / http_client_exit() leads to memory leak (at least,
if you use it with OpenSSL).

The official documentation also says that curl_global_init() should only
be called once:
https://ec.haxx.se/libcurl/libcurl-globalinit

So this patch changes the code to call the curl_global_init() and
curl_global_cleanup() in the main() function only once.

Signed-off-by: Martin Schiller ms@dev.tdt.de

Calling curl_global_init() and curl_global_cleanup() on every
http_client_init() / http_client_exit() leads to memory leak (at least,
if you use it with OpenSSL).

The official documentation also says that curl_global_init() should only
be called once:
https://ec.haxx.se/libcurl/libcurl-globalinit

So this patch changes the code to call the curl_global_init() and
curl_global_cleanup() in the main() function only once.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
@pivasoftware
Copy link
Copy Markdown
Owner

thank you for the contribution

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