From: Stefan Metzmacher Date: Wed, 5 Feb 2025 13:27:15 +0000 (+0100) Subject: libcli/lsarpc: fix talloc hierarchy in trust_forest_info_from_lsa() X-Git-Tag: tevent-0.17.0~713 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8a933ab5e618df8e2ddb6aae4f00ca7c309f2c6;p=thirdparty%2Fsamba.git libcli/lsarpc: fix talloc hierarchy in trust_forest_info_from_lsa() Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/libcli/lsarpc/util_lsarpc.c b/libcli/lsarpc/util_lsarpc.c index ed297846dc7..018bbcc0eec 100644 --- a/libcli/lsarpc/util_lsarpc.c +++ b/libcli/lsarpc/util_lsarpc.c @@ -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;