]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
nsswitch: Fix memory leak in nsstest
authorAndreas Schneider <asn@samba.org>
Tue, 15 Oct 2024 15:12:07 +0000 (17:12 +0200)
committerMartin Schwenke <martins@samba.org>
Thu, 24 Oct 2024 10:54:37 +0000 (10:54 +0000)
Direct leak of 832 byte(s) in 13 object(s) allocated from:
    #0 0x7efc8e0fc777 in malloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x562cb6e96d44 in nss_test_initgroups ../../nsswitch/nsstest.c:381
    #2 0x562cb6e96d44 in nss_test_users ../../nsswitch/nsstest.c:424
    #3 0x562cb6e96d44 in main ../../nsswitch/nsstest.c:493
    #4 0x7efc8dc2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
nsswitch/nsstest.c

index 45270cdc459e125132b35d2e7f10dca7d8c08e82..21d04b531269b75e66898106c94437e3c0be53f9 100644 (file)
@@ -395,6 +395,7 @@ static void nss_test_initgroups(char *name, gid_t gid)
                printf("%lu, ", (unsigned long)groups[i]);
        }
        printf("%lu\n", (unsigned long)groups[i]);
+       SAFE_FREE(groups);
 }