]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/lsarpc: fix talloc hierarchy in trust_forest_info_from_lsa()
authorStefan Metzmacher <metze@samba.org>
Wed, 5 Feb 2025 13:27:15 +0000 (14:27 +0100)
committerRalph Boehme <slow@samba.org>
Sat, 22 Feb 2025 16:00:36 +0000 (16:00 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
libcli/lsarpc/util_lsarpc.c

index ed297846dc79bc674274a68501f84967b2533ed7..018bbcc0eec91d0eb75693d9fb6701f239222030 100644 (file)
@@ -375,7 +375,7 @@ NTSTATUS trust_forest_info_from_lsa(TALLOC_CTX *mem_ctx,
 
        fti->version = 1;
        fti->count = lfti->count;
-       fti->records = talloc_zero_array(mem_ctx,
+       fti->records = talloc_zero_array(fti,
                                         struct ForestTrustInfoRecordArmor,
                                         fti->count);
        if (fti->records == NULL) {
@@ -405,7 +405,7 @@ NTSTATUS trust_forest_info_from_lsa(TALLOC_CTX *mem_ctx,
                        lstr = &lftr->forest_trust_data.top_level_name;
                        str = &ftr->data.name;
 
-                       str->string = talloc_strdup(mem_ctx, lstr->string);
+                       str->string = talloc_strdup(fti->records, lstr->string);
                        if (str->string == NULL) {
                                TALLOC_FREE(fti);
                                return NT_STATUS_NO_MEMORY;
@@ -417,7 +417,7 @@ NTSTATUS trust_forest_info_from_lsa(TALLOC_CTX *mem_ctx,
                        lstr = &lftr->forest_trust_data.top_level_name_ex;
                        str = &ftr->data.name;
 
-                       str->string = talloc_strdup(mem_ctx, lstr->string);
+                       str->string = talloc_strdup(fti->records, lstr->string);
                        if (str->string == NULL) {
                                TALLOC_FREE(fti);
                                return NT_STATUS_NO_MEMORY;
@@ -437,7 +437,7 @@ NTSTATUS trust_forest_info_from_lsa(TALLOC_CTX *mem_ctx,
 
                        lstr = &linfo->dns_domain_name;
                        str = &info->dns_name;
-                       str->string = talloc_strdup(mem_ctx, lstr->string);
+                       str->string = talloc_strdup(fti->records, lstr->string);
                        if (str->string == NULL) {
                                TALLOC_FREE(fti);
                                return NT_STATUS_NO_MEMORY;
@@ -445,7 +445,7 @@ NTSTATUS trust_forest_info_from_lsa(TALLOC_CTX *mem_ctx,
 
                        lstr = &linfo->netbios_domain_name;
                        str = &info->netbios_name;
-                       str->string = talloc_strdup(mem_ctx, lstr->string);
+                       str->string = talloc_strdup(fti->records, lstr->string);
                        if (str->string == NULL) {
                                TALLOC_FREE(fti);
                                return NT_STATUS_NO_MEMORY;