Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leaks in test_storage #52

Open
hades opened this issue Oct 7, 2023 · 1 comment · May be fixed by #55
Open

memory leaks in test_storage #52

hades opened this issue Oct 7, 2023 · 1 comment · May be fixed by #55

Comments

@hades
Copy link

hades commented Oct 7, 2023

When running test_storage with address sanitizer, the following memory leaks are found.

To reproduce:

git clone https://github.com/hades/libomemo.git
cd libomemo
git checkout efcf195c243e95131b49d83209b232b70b1e2f27
mkdir build ; cd build
CC=clang cmake .. -DOMEMO_WITH_ASAN=ON
make
ctest --output-on-failure

Error output:

=================================================================
==15719==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x7f4a46648948 in g_malloc /usr/src/glib2.0-2.76.1-1/debian/build/deb/../../../glib/gmem.c:130:13

Direct leak of 10 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b344b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x5597d08b6fba in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x5597d08bd428 in omemo_storage_user_devicelist_retrieve /home/hades/dev/libomemo/test/../src/libomemo_storage.c:214:15
    #4 0x5597d08beafc in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:82:3
    #5 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Direct leak of 5 byte(s) in 1 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b344b in int_to_string /home/hades/dev/libomemo/test/../src/libomemo.c:111:16
    #2 0x5597d08b6fba in omemo_devicelist_add /home/hades/dev/libomemo/test/../src/libomemo.c:795:23
    #3 0x5597d08bd428 in omemo_storage_user_devicelist_retrieve /home/hades/dev/libomemo/test/../src/libomemo_storage.c:214:15
    #4 0x5597d08be904 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:74:3
    #5 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 144 byte(s) in 6 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x7f4a46648948 in g_malloc /usr/src/glib2.0-2.76.1-1/debian/build/deb/../../../glib/gmem.c:130:13

Indirect leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08bec39 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:85:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08bece8 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:86:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 8 byte(s) in 2 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08beb8a in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:84:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08bea41 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:78:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

Indirect leak of 4 byte(s) in 1 object(s) allocated from:
    #0 0x5597d087900e in __interceptor_malloc (/home/hades/dev/libomemo/build/test_storage+0xab00e) (BuildId: e86628c2deb9b1bb8d6929fed4a609fe2da65e06)
    #1 0x5597d08b7c69 in omemo_devicelist_get_id_list /home/hades/dev/libomemo/test/../src/libomemo.c:940:13
    #2 0x5597d08be992 in test_devicelist_retrieve /home/hades/dev/libomemo/test/test_storage.c:77:3
    #3 0x7f4a4687daab in cmocka_run_one_test_or_fixture obj-x86_64-linux-gnu/src/./src/cmocka.c:2801:13

SUMMARY: AddressSanitizer: 239 byte(s) leaked in 19 allocation(s).
@hades hades linked a pull request Oct 16, 2023 that will close this issue
@Neustradamus
Copy link
Contributor

@gkdr: Have you seen this issue?

There is a PR to solve it!

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 a pull request may close this issue.

2 participants