1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

kdc-db-glue: Fix memory cleanup to avoid crashes.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andreas Schneider 2015-02-25 11:55:43 +01:00 committed by Stefan Metzmacher
parent 6ada266dcf
commit aa1431e53f

View File

@ -588,9 +588,9 @@ static krb5_error_code samba_kdc_message2entry(krb5_context context,
is_computer = TRUE; is_computer = TRUE;
} }
memset(entry_ex, 0, sizeof(*entry_ex)); ZERO_STRUCTP(entry_ex);
p = talloc(mem_ctx, struct samba_kdc_entry); p = talloc_zero(mem_ctx, struct samba_kdc_entry);
if (!p) { if (!p) {
ret = ENOMEM; ret = ENOMEM;
goto out; goto out;
@ -937,6 +937,7 @@ out:
if (ret != 0) { if (ret != 0) {
/* This doesn't free ent itself, that is for the eventual caller to do */ /* This doesn't free ent itself, that is for the eventual caller to do */
hdb_free_entry(context, entry_ex); hdb_free_entry(context, entry_ex);
ZERO_STRUCTP(entry_ex);
} else { } else {
talloc_steal(kdc_db_ctx, entry_ex->ctx); talloc_steal(kdc_db_ctx, entry_ex->ctx);
} }