From 7a0b65efce3669643d21a2e209d4bf2626a5e948 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 7 May 2006 04:16:48 +0000 Subject: 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) --- source4/kdc/hdb-ldb.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source4') 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); } -- cgit