Skip to content

Memory leak under Ubuntu 26.04 #31

Closed

Description

@alt-graph

ASAN detects a small memory leak. It may come from libgit2, but that would need to be verified:

==3979==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7ab5a3129ddf in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:67
    #1 0x7ab5a2dbd0a3  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x190a3) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #2 0x7ab5a2dbf524  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x1b524) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #3 0x7ab5a2dbf621 in git_error_set (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x1b621) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #4 0x7ab5a2e3c08e  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x9808e) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #5 0x7ab5a2e42cb8 in git_odb_free (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x9ecb8) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #6 0x7ab5a2e717f8 in git_repository__cleanup (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xcd7f8) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #7 0x7ab5a2e71865 in git_repository_free (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xcd865) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #8 0x7ab5a2ea1217  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xfd217) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #9 0x7ab5a2e6e5bc in git_remote_disconnect (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xca5bc) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #10 0x7ab5a2e6e619 in git_remote_free (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xca619) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #11 0x637adc6c4148 in std::unique_ptr<git_remote, void (*)(git_remote*)>::~unique_ptr() /usr/include/c++/15/bits/unique_ptr.h:398
    #12 0x637adc6c2aaf in git::Remote::~Remote() ../include/libgit4cpp/Remote.h:44
    #13 0x637adc6bfb06 in CATCH2_INTERNAL_TEST_2 ../tests/test_Remote.cc:105
    #14 0x637adc741010 in invoke ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_test_registry.cpp:60
    #15 0x637adc7219cb in Catch::TestCaseHandle::invoke() const ../subprojects/Catch2-3.8.1/src/catch2/catch_test_case_info.hpp:124
    #16 0x637adc71eba0 in Catch::RunContext::invokeActiveTestCase() ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_run_context.cpp:580
    #17 0x637adc71e4da in Catch::RunContext::runCurrentTest() ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_run_context.cpp:543
    #18 0x637adc719682 in Catch::RunContext::runTest(Catch::TestCaseHandle const&) ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_run_context.cpp:240
    #19 0x637adc7b4ffd in execute ../subprojects/Catch2-3.8.1/src/catch2/catch_session.cpp:117
    #20 0x637adc7b7c61 in Catch::Session::runInternal() ../subprojects/Catch2-3.8.1/src/catch2/catch_session.cpp:337
    #21 0x637adc7b71fa in Catch::Session::run() ../subprojects/Catch2-3.8.1/src/catch2/catch_session.cpp:269
    #22 0x637adc6bbed7 in int Catch::Session::run<char>(int, char const* const*) ../subprojects/Catch2-3.8.1/src/catch2/catch_session.hpp:41
    #23 0x637adc6bb68a in main ../tests/test_main.cc:39
    #24 0x7ab5a262a8c0  (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a8c0) (BuildId: 4ec69afdf3da96ce7388640dcd27c6d0c1b256ef)
    #25 0x7ab5a262a9d7 in __libc_start_main (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a9d7) (BuildId: 4ec69afdf3da96ce7388640dcd27c6d0c1b256ef)
    #26 0x637adc6b3e94 in _start (/home/runner/work/libgit4cpp/libgit4cpp/build.asan/tests/libgit4cpp_test+0x73e94) (BuildId: 0509800819a07fd34e63f448adf0ae793e58a0ae)

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7ab5a3129ddf in malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:67
    #1 0x7ab5a2dbd0a3  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x190a3) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #2 0x7ab5a2dbf4d4  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x1b4d4) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #3 0x7ab5a2dbf621 in git_error_set (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x1b621) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #4 0x7ab5a2e3c08e  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x9808e) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #5 0x7ab5a2e42cb8 in git_odb_free (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x9ecb8) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #6 0x7ab5a2e717f8 in git_repository__cleanup (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xcd7f8) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #7 0x7ab5a2e71865 in git_repository_free (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xcd865) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #8 0x7ab5a2ea1217  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xfd217) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #9 0x7ab5a2e6e5bc in git_remote_disconnect (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xca5bc) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #10 0x7ab5a2e6e619 in git_remote_free (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xca619) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #11 0x637adc6c4148 in std::unique_ptr<git_remote, void (*)(git_remote*)>::~unique_ptr() /usr/include/c++/15/bits/unique_ptr.h:398
    #12 0x637adc6c2aaf in git::Remote::~Remote() ../include/libgit4cpp/Remote.h:44
    #13 0x637adc6bfb06 in CATCH2_INTERNAL_TEST_2 ../tests/test_Remote.cc:105
    #14 0x637adc741010 in invoke ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_test_registry.cpp:60
    #15 0x637adc7219cb in Catch::TestCaseHandle::invoke() const ../subprojects/Catch2-3.8.1/src/catch2/catch_test_case_info.hpp:124
    #16 0x637adc71eba0 in Catch::RunContext::invokeActiveTestCase() ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_run_context.cpp:580
    #17 0x637adc71e4da in Catch::RunContext::runCurrentTest() ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_run_context.cpp:543
    #18 0x637adc719682 in Catch::RunContext::runTest(Catch::TestCaseHandle const&) ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_run_context.cpp:240
    #19 0x637adc7b4ffd in execute ../subprojects/Catch2-3.8.1/src/catch2/catch_session.cpp:117
    #20 0x637adc7b7c61 in Catch::Session::runInternal() ../subprojects/Catch2-3.8.1/src/catch2/catch_session.cpp:337
    #21 0x637adc7b71fa in Catch::Session::run() ../subprojects/Catch2-3.8.1/src/catch2/catch_session.cpp:269
    #22 0x637adc6bbed7 in int Catch::Session::run<char>(int, char const* const*) ../subprojects/Catch2-3.8.1/src/catch2/catch_session.hpp:41
    #23 0x637adc6bb68a in main ../tests/test_main.cc:39
    #24 0x7ab5a262a8c0  (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a8c0) (BuildId: 4ec69afdf3da96ce7388640dcd27c6d0c1b256ef)
    #25 0x7ab5a262a9d7 in __libc_start_main (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a9d7) (BuildId: 4ec69afdf3da96ce7388640dcd27c6d0c1b256ef)
    #26 0x637adc6b3e94 in _start (/home/runner/work/libgit4cpp/libgit4cpp/build.asan/tests/libgit4cpp_test+0x73e94) (BuildId: 0509800819a07fd34e63f448adf0ae793e58a0ae)

Indirect leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x7ab5a3128e9f in realloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:81
    #1 0x7ab5a2dc1a7f  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x1da7f) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #2 0x7ab5a2dbf332  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x1b332) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #3 0x7ab5a2dbf41e  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x1b41e) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #4 0x7ab5a2dbf621 in git_error_set (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x1b621) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #5 0x7ab5a2e3c08e  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x9808e) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #6 0x7ab5a2e42cb8 in git_odb_free (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0x9ecb8) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #7 0x7ab5a2e717f8 in git_repository__cleanup (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xcd7f8) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #8 0x7ab5a2e71865 in git_repository_free (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xcd865) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #9 0x7ab5a2ea1217  (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xfd217) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #10 0x7ab5a2e6e5bc in git_remote_disconnect (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xca5bc) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #11 0x7ab5a2e6e619 in git_remote_free (/usr/lib/x86_64-linux-gnu/libgit2.so.1.9+0xca619) (BuildId: 68a0c2ee0ac7eeb746b2fd8754f3dc3b3c43f5c9)
    #12 0x637adc6c4148 in std::unique_ptr<git_remote, void (*)(git_remote*)>::~unique_ptr() /usr/include/c++/15/bits/unique_ptr.h:398
    #13 0x637adc6c2aaf in git::Remote::~Remote() ../include/libgit4cpp/Remote.h:44
    #14 0x637adc6bfb06 in CATCH2_INTERNAL_TEST_2 ../tests/test_Remote.cc:105
    #15 0x637adc741010 in invoke ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_test_registry.cpp:60
    #16 0x637adc7219cb in Catch::TestCaseHandle::invoke() const ../subprojects/Catch2-3.8.1/src/catch2/catch_test_case_info.hpp:124
    #17 0x637adc71eba0 in Catch::RunContext::invokeActiveTestCase() ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_run_context.cpp:580
    #18 0x637adc71e4da in Catch::RunContext::runCurrentTest() ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_run_context.cpp:543
    #19 0x637adc719682 in Catch::RunContext::runTest(Catch::TestCaseHandle const&) ../subprojects/Catch2-3.8.1/src/catch2/internal/catch_run_context.cpp:240
    #20 0x637adc7b4ffd in execute ../subprojects/Catch2-3.8.1/src/catch2/catch_session.cpp:117
    #21 0x637adc7b7c61 in Catch::Session::runInternal() ../subprojects/Catch2-3.8.1/src/catch2/catch_session.cpp:337
    #22 0x637adc7b71fa in Catch::Session::run() ../subprojects/Catch2-3.8.1/src/catch2/catch_session.cpp:269
    #23 0x637adc6bbed7 in int Catch::Session::run<char>(int, char const* const*) ../subprojects/Catch2-3.8.1/src/catch2/catch_session.hpp:41
    #24 0x637adc6bb68a in main ../tests/test_main.cc:39
    #25 0x7ab5a262a8c0  (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a8c0) (BuildId: 4ec69afdf3da96ce7388640dcd27c6d0c1b256ef)
    #26 0x7ab5a262a9d7 in __libc_start_main (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2a9d7) (BuildId: 4ec69afdf3da96ce7388640dcd27c6d0c1b256ef)
    #27 0x637adc6b3e94 in _start (/home/runner/work/libgit4cpp/libgit4cpp/build.asan/tests/libgit4cpp_test+0x73e94) (BuildId: 0509800819a07fd34e63f448adf0ae793e58a0ae)

SUMMARY: AddressSanitizer: 200 byte(s) leaked in 3 allocation(s).
==============================================================================

Activity

  1. alt-graph commented on Oct 14, 2026

    @alt-graph
    MemberAuthor

    Resolved by commit b3274f2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions