diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-08-07 02:53:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:27 -0500 |
commit | 232704793eb9bc5e89f8626fa96f5c33f00269cb (patch) | |
tree | 957d1e06aac727591a03b689795db5a2cdfdda89 /source4/kdc | |
parent | 3e905b583fa4b04eca332aeda94e9a5a0e2b4ae7 (diff) | |
download | samba-232704793eb9bc5e89f8626fa96f5c33f00269cb.tar.gz samba-232704793eb9bc5e89f8626fa96f5c33f00269cb.tar.bz2 samba-232704793eb9bc5e89f8626fa96f5c33f00269cb.zip |
r9170: fix crash bug
metze
(This used to be commit 232b04bf3e5ff185cf8c6401a19960afd42b5d6c)
Diffstat (limited to 'source4/kdc')
-rw-r--r-- | source4/kdc/hdb-ldb.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c index 444382f2a0..344cf74ff6 100644 --- a/source4/kdc/hdb-ldb.c +++ b/source4/kdc/hdb-ldb.c @@ -461,7 +461,7 @@ static krb5_error_code LDB_lookup_principal(krb5_context context, struct ldb_con char *princ_str_talloc; char *short_princ; - struct ldb_message **msg; + struct ldb_message **msg = NULL; /* Structure assignment, so we don't mess with the source parameter */ struct Principal princ = *principal; @@ -521,7 +521,6 @@ static krb5_error_code LDB_lookup_principal(krb5_context context, struct ldb_con count = ldb_search(ldb_ctx, realm_dn, LDB_SCOPE_SUBTREE, filter, princ_attrs, &msg); - *pmsg = talloc_steal(mem_ctx, msg); if (count < 1) { krb5_warnx(context, "ldb_search: basedn: '%s' filter: '%s' failed: %d", realm_dn, filter, count); @@ -529,12 +528,14 @@ static krb5_error_code LDB_lookup_principal(krb5_context context, struct ldb_con realm_dn, filter, count); return HDB_ERR_NOENTRY; } else if (count > 1) { + talloc_free(msg); krb5_warnx(context, "ldb_search: basedn: '%s' filter: '%s' more than 1 entry: %d", realm_dn, filter, count); krb5_set_error_string(context, "ldb_search: basedn: '%s' filter: '%s' more than 1 entry: %d", realm_dn, filter, count); return HDB_ERR_NOENTRY; } + *pmsg = talloc_steal(mem_ctx, msg); return 0; } |