[Bug 1196859] New: libcurl memory leak: curl_global_cleanup() does not free all memory allocated by curl_global_init(CURL_GLOBAL_ALL)
![](https://seccdn.libravatar.org/avatar/a895f78a81a109471893519443e4d933.jpg?s=120&d=mm&r=g)
http://bugzilla.opensuse.org/show_bug.cgi?id=1196859 Bug ID: 1196859 Summary: libcurl memory leak: curl_global_cleanup() does not free all memory allocated by curl_global_init(CURL_GLOBAL_ALL) Classification: openSUSE Product: openSUSE Distribution Version: Leap 15.3 Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem Assignee: screening-team-bugs@suse.de Reporter: joern.padeken@dsa.de QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- Created attachment 856830 --> http://bugzilla.opensuse.org/attachment.cgi?id=856830&action=edit C-source of demonstration program curl_global_cleanup() does not free all memory allocated by curl_global_init(CURL_GLOBAL_ALL). This may, for example, happen when calling XMLPlatformUtils::Initialize() and XMLPlatformUtils::Terminate() repeatedly. In detail, curl_global_init(CURL_GLOBAL_ALL) calls the functions ASN1_add_oid_module(), ASN1_add_stable_module(), ENGINE_add_conf_module() and EVP_add_alg_module(). However, there are no corresponding function calls in curl_global_cleanup() to free requested memory. I attached a small program to demonstrate. -- You are receiving this mail because: You are on the CC list for the bug.
![](https://seccdn.libravatar.org/avatar/a895f78a81a109471893519443e4d933.jpg?s=120&d=mm&r=g)
http://bugzilla.opensuse.org/show_bug.cgi?id=1196859 Andreas Stieger <Andreas.Stieger@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|screening-team-bugs@suse.de |pmonrealgonzalez@suse.com -- You are receiving this mail because: You are on the CC list for the bug.
![](https://seccdn.libravatar.org/avatar/a895f78a81a109471893519443e4d933.jpg?s=120&d=mm&r=g)
http://bugzilla.opensuse.org/show_bug.cgi?id=1196859 http://bugzilla.opensuse.org/show_bug.cgi?id=1196859#c1 --- Comment #1 from Pedro Monreal Gonzalez <pmonrealgonzalez@suse.com> --- Thanks for your report. I read this is Leap 15.3 and I assume x86_64. I can't find the leak with valgrind, see: ==10943== LEAK SUMMARY: ==10943== definitely lost: 0 bytes in 0 blocks ==10943== indirectly lost: 0 bytes in 0 blocks ==10943== possibly lost: 0 bytes in 0 blocks ==10943== still reachable: 112 bytes in 2 blocks ==10943== suppressed: 0 bytes in 0 blocks ==10943== ==10943== For lists of detected and suppressed errors, rerun with: -s ==10943== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) I'll try to follow the curl_global_cleanup() calls. -- You are receiving this mail because: You are on the CC list for the bug.
![](https://seccdn.libravatar.org/avatar/a895f78a81a109471893519443e4d933.jpg?s=120&d=mm&r=g)
http://bugzilla.opensuse.org/show_bug.cgi?id=1196859 http://bugzilla.opensuse.org/show_bug.cgi?id=1196859#c2 --- Comment #2 from J�rn Padeken <joern.padeken@dsa.de> --- Yes, the problem occurs on Leap 15.3 / x86_64. I also found, that valgrind does not report any leak (should have mentioned that) but if you run the attached program, you'll see that number of used pages is increasing. Maybe the memory is free()'d, when the program ends. If you add _exit(0), the amount of bytes/blocks for "still reachable:" is significatly larger. -- You are receiving this mail because: You are on the CC list for the bug.
![](https://seccdn.libravatar.org/avatar/a895f78a81a109471893519443e4d933.jpg?s=120&d=mm&r=g)
http://bugzilla.opensuse.org/show_bug.cgi?id=1196859 http://bugzilla.opensuse.org/show_bug.cgi?id=1196859#c3 --- Comment #3 from J�rn Padeken <joern.padeken@dsa.de> --- I checked OpenSuse Tumbleweed 20220314 (with libopenssl1_1-1.1.1m-4.1.x86_64 and libcurl4-7.82.0-1.1.x86_64) for this problem and on this system it did not occur. -- You are receiving this mail because: You are on the CC list for the bug.
![](https://seccdn.libravatar.org/avatar/a895f78a81a109471893519443e4d933.jpg?s=120&d=mm&r=g)
http://bugzilla.opensuse.org/show_bug.cgi?id=1196859 http://bugzilla.opensuse.org/show_bug.cgi?id=1196859#c4 --- Comment #4 from Pedro Monreal Gonzalez <pmonrealgonzalez@suse.com> --- OK, I can get an OOM after a long run: [ pid ] uid tgid total_vm rss pgtables_bytes swapents oom_score_adj name [ 8121] 0 8121 742463 448015 5787648 254037 0 mleakcurl oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=mleakcurl,pid=8121,uid=0 Out of memory: Killed process 8121 (mleakcurl) total-vm:2969852kB, anon-rss:1791828kB, file-rss:232kB, shmem-rss:0kB I'll take a look tomorrow! -- You are receiving this mail because: You are on the CC list for the bug.
![](https://seccdn.libravatar.org/avatar/a895f78a81a109471893519443e4d933.jpg?s=120&d=mm&r=g)
http://bugzilla.opensuse.org/show_bug.cgi?id=1196859 http://bugzilla.opensuse.org/show_bug.cgi?id=1196859#c6 --- Comment #6 from J�rn Padeken <joern.padeken@dsa.de> --- Problem is caused by this bug: https://curl.se/bug/?i=6254 - openssl: use OPENSSL_init_ssl() with >= 1.1.0 Bug will be fixed with curl-7.74.0 (https://curl.se/changes.html#7_74_0). -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@suse.com