1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

s4:kdc: Move calls to talloc_steal() out of the ‘out’ paths

This simplifies the ‘out’ paths.

Every code path that reaches ‘out’ via a goto ensures that ‘ret’ is set
to a nonzero value.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-08-10 15:25:50 +12:00 committed by Andrew Bartlett
parent bf78c60368
commit e9c275b4e0

View File

@ -1701,12 +1701,12 @@ static krb5_error_code samba_kdc_message2entry(krb5_context context,
p->client_policy = talloc_steal(p, authn_client_policy);
p->server_policy = talloc_steal(p, authn_server_policy);
talloc_steal(kdc_db_ctx, p);
out:
if (ret != 0) {
/* This doesn't free ent itself, that is for the eventual caller to do */
sdb_entry_free(entry);
} else {
talloc_steal(kdc_db_ctx, p);
}
return ret;
@ -2164,14 +2164,14 @@ static krb5_error_code samba_kdc_trust_message2entry(krb5_context context,
p->msg = talloc_steal(p, msg);
talloc_steal(kdc_db_ctx, p);
out:
TALLOC_FREE(partner_realm);
if (ret != 0) {
/* This doesn't free ent itself, that is for the eventual caller to do */
sdb_entry_free(entry);
} else {
talloc_steal(kdc_db_ctx, p);
}
return ret;