From: Volker Lendecke Date: Fri, 6 Oct 2023 06:00:06 +0000 (+0200) Subject: dsdb: Slightly simplify dsdb_trust_get_incoming_passwords() X-Git-Tag: tevent-0.16.0~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2e5ae1eb24f25eadfae9ce87a88643ee9966eb0;p=thirdparty%2Fsamba.git dsdb: Slightly simplify dsdb_trust_get_incoming_passwords() Use talloc_memdup() instead of a manual copy. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source4/dsdb/common/util_trusts.c b/source4/dsdb/common/util_trusts.c index 175af655443..5003e7499b0 100644 --- a/source4/dsdb/common/util_trusts.c +++ b/source4/dsdb/common/util_trusts.c @@ -2746,15 +2746,15 @@ NTSTATUS dsdb_trust_get_incoming_passwords(struct ldb_message *msg, } if (_current != NULL) { - *_current = talloc(mem_ctx, struct samr_Password); + *_current = talloc_memdup(mem_ctx, current, sizeof(*current)); if (*_current == NULL) { TALLOC_FREE(frame); return NT_STATUS_NO_MEMORY; } - **_current = *current; } if (_previous != NULL) { - *_previous = talloc(mem_ctx, struct samr_Password); + *_previous = + talloc_memdup(mem_ctx, previous, sizeof(*previous)); if (*_previous == NULL) { if (_current != NULL) { TALLOC_FREE(*_current); @@ -2762,7 +2762,6 @@ NTSTATUS dsdb_trust_get_incoming_passwords(struct ldb_message *msg, TALLOC_FREE(frame); return NT_STATUS_NO_MEMORY; } - **_previous = *previous; } ZERO_STRUCTP(current); ZERO_STRUCTP(previous);