From 9c64a05786e62dafaaab0977d494556c7ea3a844 Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Tue, 15 Feb 2022 13:40:38 +0100 Subject: tests: media: Fix leaks of OsinfoMedia * ==419218== 785 (48 direct, 737 indirect) bytes in 1 blocks are definitely lost in loss record 2,438 of 2,468 ==419218== at 0x48F3437: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DAD4C: ??? (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC2C7: g_object_new_valist (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC7FC: g_object_new (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x487D918: osinfo_media_new (osinfo_media.c:704) ==419218== by 0x4034CF: test_create_media (test-media.c:151) ==419218== by 0x4034CF: test_matching (test-media.c:228) ==419218== by 0x4992BD5: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49928FA: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930A9: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930D0: g_test_run (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x40232F: main (test-media.c:257) ==419218== ==419218== 787 (48 direct, 739 indirect) bytes in 1 blocks are definitely lost in loss record 2,439 of 2,468 ==419218== at 0x48F3437: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DAD4C: ??? (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC2C7: g_object_new_valist (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC7FC: g_object_new (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x487D918: osinfo_media_new (osinfo_media.c:704) ==419218== by 0x4033EB: test_create_media (test-media.c:151) ==419218== by 0x4033EB: test_matching (test-media.c:188) ==419218== by 0x4992BD5: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49928FA: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930A9: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930D0: g_test_run (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x40232F: main (test-media.c:257) ==419218== ==419218== 827 (48 direct, 779 indirect) bytes in 1 blocks are definitely lost in loss record 2,440 of 2,468 ==419218== at 0x48F3437: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DAD4C: ??? (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC2C7: g_object_new_valist (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC7FC: g_object_new (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x487D918: osinfo_media_new (osinfo_media.c:704) ==419218== by 0x402EF3: test_create_media (test-media.c:151) ==419218== by 0x403435: test_matching (test-media.c:196) ==419218== by 0x4992BD5: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49928FA: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930A9: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930D0: g_test_run (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x40232F: main (test-media.c:257) ==419218== ==419218== 871 (48 direct, 823 indirect) bytes in 1 blocks are definitely lost in loss record 2,443 of 2,468 ==419218== at 0x48F3437: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DAD4C: ??? (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC2C7: g_object_new_valist (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC7FC: g_object_new (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x487D918: osinfo_media_new (osinfo_media.c:704) ==419218== by 0x402EF3: test_create_media (test-media.c:151) ==419218== by 0x403491: test_matching (test-media.c:212) ==419218== by 0x4992BD5: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49928FA: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930A9: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930D0: g_test_run (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x40232F: main (test-media.c:257) ==419218== ==419218== 871 (48 direct, 823 indirect) bytes in 1 blocks are definitely lost in loss record 2,444 of 2,468 ==419218== at 0x48F3437: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DAD4C: ??? (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC2C7: g_object_new_valist (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC7FC: g_object_new (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x487D918: osinfo_media_new (osinfo_media.c:704) ==419218== by 0x402EF3: test_create_media (test-media.c:151) ==419218== by 0x4034BB: test_matching (test-media.c:220) ==419218== by 0x4992BD5: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49928FA: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930A9: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930D0: g_test_run (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x40232F: main (test-media.c:257) ==419218== ==419218== 929 (48 direct, 881 indirect) bytes in 1 blocks are definitely lost in loss record 2,446 of 2,468 ==419218== at 0x48F3437: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DAD4C: ??? (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC2C7: g_object_new_valist (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC7FC: g_object_new (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x487D918: osinfo_media_new (osinfo_media.c:704) ==419218== by 0x402EF3: test_create_media (test-media.c:151) ==419218== by 0x403467: test_matching (test-media.c:204) ==419218== by 0x4992BD5: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49928FA: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930A9: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930D0: g_test_run (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x40232F: main (test-media.c:257) ==419218== ==419218== 949 (48 direct, 901 indirect) bytes in 1 blocks are definitely lost in loss record 2,447 of 2,468 ==419218== at 0x48F3437: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DAD4C: ??? (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC2C7: g_object_new_valist (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x48DC7FC: g_object_new (in /usr/lib64/libgobject-2.0.so.0.7000.3) ==419218== by 0x487D918: osinfo_media_new (osinfo_media.c:704) ==419218== by 0x402EF3: test_create_media (test-media.c:151) ==419218== by 0x4033D7: test_matching (test-media.c:180) ==419218== by 0x4992BD5: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49928FA: ??? (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930A9: g_test_run_suite (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x49930D0: g_test_run (in /usr/lib64/libglib-2.0.so.0.7000.3) ==419218== by 0x40232F: main (test-media.c:257) Signed-off-by: Victor Toso --- tests/test-media.c | 98 +++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/tests/test-media.c b/tests/test-media.c index 81c8d0a..44abbe5 100644 --- a/tests/test-media.c +++ b/tests/test-media.c @@ -177,61 +177,61 @@ test_create_media(const char *id, static void test_matching(void) { - OsinfoMedia *unknown = test_create_media("https://libosinfo.org/test/", - "x86_64", - "Fedora 35", - "LINUX", - "Fedora", - "Fedora OS", - 1234567); + g_autoptr(OsinfoMedia) unknown = test_create_media("https://libosinfo.org/test/", + "x86_64", + "Fedora 35", + "LINUX", + "Fedora", + "Fedora OS", + 1234567); /* Match with several optional fields */ - OsinfoMedia *reference1 = test_create_media("https://fedoraproject.org/fedora/35/media1", - "x86_64", - "Fedora 35", - NULL, - NULL, - NULL, - 0); + g_autoptr(OsinfoMedia) reference1 = test_create_media("https://fedoraproject.org/fedora/35/media1", + "x86_64", + "Fedora 35", + NULL, + NULL, + NULL, + 0); /* Mis-match on volume */ - OsinfoMedia *reference2 = test_create_media("https://fedoraproject.org/fedora/34/media2", - "x86_64", - "Fedora 34", - "LINUX", - NULL, - NULL, - 0); + g_autoptr(OsinfoMedia) reference2 = test_create_media("https://fedoraproject.org/fedora/34/media2", + "x86_64", + "Fedora 34", + "LINUX", + NULL, + NULL, + 0); /* Match with all fields with some regexes */ - OsinfoMedia *reference3 = test_create_media("https://fedoraproject.org/fedora/unknown/media3", - "x86_64", - "Fedora [0-9]+", - "LINUX", - "Fedora", - "Fedora OS", - 0); + g_autoptr(OsinfoMedia) reference3 = test_create_media("https://fedoraproject.org/fedora/unknown/media3", + "x86_64", + "Fedora [0-9]+", + "LINUX", + "Fedora", + "Fedora OS", + 0); /* Match including vol size */ - OsinfoMedia *reference4 = test_create_media("https://fedoraproject.org/fedora/35/media4", - "x86_64", - "Fedora 35", - "LINUX", - NULL, - NULL, - 1234567); + g_autoptr(OsinfoMedia) reference4 = test_create_media("https://fedoraproject.org/fedora/35/media4", + "x86_64", + "Fedora 35", + "LINUX", + NULL, + NULL, + 1234567); /* Mis-match on vol size */ - OsinfoMedia *reference5 = test_create_media("https://fedoraproject.org/fedora/35/media5", - "x86_64", - "Fedora 35", - "LINUX", - NULL, - NULL, - 1234568); + g_autoptr(OsinfoMedia) reference5 = test_create_media("https://fedoraproject.org/fedora/35/media5", + "x86_64", + "Fedora 35", + "LINUX", + NULL, + NULL, + 1234568); /* Mis-match on arch */ - OsinfoMedia *reference6 = test_create_media("https://fedoraproject.org/fedora/35/media1", - "i686", - "Fedora 35", - NULL, - NULL, - NULL, - 0); + g_autoptr(OsinfoMedia) reference6 = test_create_media("https://fedoraproject.org/fedora/35/media1", + "i686", + "Fedora 35", + NULL, + NULL, + NULL, + 0); g_assert(osinfo_media_matches(unknown, reference1)); g_assert(!osinfo_media_matches(unknown, reference2)); g_assert(osinfo_media_matches(unknown, reference3)); -- cgit v1.2.1