]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
util/tests: Extend the 'test_talloc_keep_secret' test
authorPavel Filipenský <pfilipensky@samba.org>
Wed, 11 Mar 2026 18:36:22 +0000 (19:36 +0100)
committerPavel Filipensky <pfilipensky@samba.org>
Wed, 25 Mar 2026 20:10:37 +0000 (20:10 +0000)
Test that talloc_strdup() puts the secret as talloc name.

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
lib/util/tests/test_talloc_keep_secret.c

index 66c3f7f3e7a1db267405ec31efb1b55cfe607309..78ef7619394f73c5b0c748dd9893c8b1cc323b45 100644 (file)
@@ -35,6 +35,13 @@ static void test_talloc_keep_secret(void ** state)
        assert_non_null(ptr1);
        assert_string_equal(ptr1, "secret");
 
+       ptr1_talloc_name = talloc_get_name(ptr1);
+       assert_string_equal(ptr1_talloc_name, "secret");
+
+       /*
+        * talloc_keep_secret() changes the talloc name if the name reveals the
+        * memory content.
+        */
        talloc_keep_secret(ptr1);
 
        ptr1_talloc_name = talloc_get_name(ptr1);