Closed
Description
Describe the bug
LeakSanitizer detected a leak in httplib::hosted_at
. This function uses getaddrinfo
to get a list of addresses, but does not free the list afterwards. You should call freeaddrinfo(result)
before returning from the function.
To reproduce
Compile with ASAN and make a call to httplib::hosted_at
. You should be able to see a new leak in ASAN output
ASAN output
Direct leak of 64 byte(s) in 1 object(s) allocated from:
#0 0x7fa9bcf61c47 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x7fa9bca47c29 (/lib/x86_64-linux-gnu/libc.so.6+0x103c29)
#2 0x7fa9bca49f88 in getaddrinfo (/lib/x86_64-linux-gnu/libc.so.6+0x105f88)
#3 0x7fa9bcf3a6f6 in __interceptor_getaddrinfo ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:2602
#4 0x55e2ca29de00 in httplib::hosted_at(char const*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) vcpkg/installed/x64-linux-static/include/httplib.h:4357
Metadata
Assignees
Labels
No labels