summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-05-07 04:16:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:39 -0500
commit7a0b65efce3669643d21a2e209d4bf2626a5e948 (patch)
treea3f2ba42505fa11520d2f2402ad572970fffcdef
parent55969efea3185a9aaf2ffa86969be9554c84863b (diff)
downloadsamba-7a0b65efce3669643d21a2e209d4bf2626a5e948.tar.gz
samba-7a0b65efce3669643d21a2e209d4bf2626a5e948.tar.bz2
samba-7a0b65efce3669643d21a2e209d4bf2626a5e948.zip
r15480: Patch from lha, to ensure we don't leave a free()'ed element in the
principal on strdup failure. Andrew Bartlett (This used to be commit d72fafc1f0089212634fc1a77352b47970e82410)
-rw-r--r--source4/kdc/hdb-ldb.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c
index 2a2ebb059c..5fd48c49ef 100644
--- a/source4/kdc/hdb-ldb.c
+++ b/source4/kdc/hdb-ldb.c
@@ -295,9 +295,6 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
* replace the client principal's realm with the one
* we determine from our records */
- /* don't leak */
- free(*krb5_princ_realm(context, entry_ex->entry.principal));
-
/* this has to be with malloc() */
strdup_realm = strdup(realm);
if (!strdup_realm) {
@@ -305,6 +302,7 @@ static krb5_error_code LDB_message2entry(krb5_context context, HDB *db,
krb5_clear_error_string(context);
goto out;
}
+ free(*krb5_princ_realm(context, entry_ex->entry.principal));
krb5_princ_set_realm(context, entry_ex->entry.principal, &strdup_realm);
}