maru / libmicrohttpd-http2

HTTP/2 support for libmicrohttpd
https://http2.s106.net/
Other
22 stars 6 forks source link

Memory leaks #53

Closed rockdaboot closed 5 years ago

rockdaboot commented 5 years ago

Testing with valgrind, I see several memory leaks in the h2 code. Run the tests with

make check LOG_COMPILER="valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all"

You'll find e.g. in test_get_sendfile_http2.log:

...
==29595== 837 (456 direct, 381 indirect) bytes in 3 blocks are definitely lost in loss record 23 of 23
==29595==    at 0x4837B65: calloc (vg_replace_malloc.c:752)
==29595==    by 0x485EEC3: MHD_create_response_from_data (response.c:686)
==29595==    by 0x485F047: MHD_create_response_from_buffer (response.c:738)
==29595==    by 0x486855D: h2_do_h2_upgrade (h2_upgrade.c:105)
==29595==    by 0x484F0C5: MHD_connection_handle_idle (connection.c:3840)
==29595==    by 0x4851D8E: call_handlers (daemon.c:1140)
==29595==    by 0x4855F24: internal_run_from_select (daemon.c:3500)
==29595==    by 0x48565E1: MHD_select (daemon.c:3764)
==29595==    by 0x4858386: MHD_polling_thread (daemon.c:4690)
==29595==    by 0x485FD1B: named_thread_starter (mhd_threads.c:275)
==29595==    by 0x4979FA2: start_thread (pthread_create.c:486)
==29595==    by 0x4A8C4CE: clone (clone.S:95)
==29595==
==29595== LEAK SUMMARY:
==29595==    definitely lost: 760 bytes in 5 blocks
==29595==    indirectly lost: 635 bytes in 30 blocks
==29595==      possibly lost: 0 bytes in 0 blocks
==29595==    still reachable: 192 bytes in 12 blocks
==29595==         suppressed: 0 bytes in 0 blocks
maru commented 5 years ago

Thank you for pointing this out! I'll work on it and keep you posted!

maru commented 5 years ago

Fixed in a0a6d0a08eedf98b3596fba2042644030b579b73