svn rev #22020: branches/krb5-1-7/src/lib/krb5/keytab/
tlyu@MIT.EDU
tlyu at MIT.EDU
Wed Feb 18 13:18:56 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=22020
Commit By: tlyu
Log Message:
ticket: 6367
version_fixed: 1.7
status: resolved
pull up r21890 from trunk
------------------------------------------------------------------------
r21890 | ghudson | 2009-02-05 13:19:23 -0500 (Thu, 05 Feb 2009) | 7 lines
Changed paths:
M /trunk/src/lib/krb5/keytab/ktbase.c
ticket: 6367
tags: pullup
target_version: 1.7
Fix a memory leak in krb5_kt_resolve when we fail to lock
kt_typehead_lock.
------------------------------------------------------------------------
Changed Files:
U branches/krb5-1-7/src/lib/krb5/keytab/ktbase.c
Modified: branches/krb5-1-7/src/lib/krb5/keytab/ktbase.c
===================================================================
--- branches/krb5-1-7/src/lib/krb5/keytab/ktbase.c 2009-02-18 18:18:28 UTC (rev 22019)
+++ branches/krb5-1-7/src/lib/krb5/keytab/ktbase.c 2009-02-18 18:18:56 UTC (rev 22020)
@@ -162,10 +162,10 @@
krb5_kt_resolve (krb5_context context, const char *name, krb5_keytab *ktid)
{
const struct krb5_kt_typelist *tlist;
- char *pfx;
+ char *pfx = NULL;
unsigned int pfxlen;
const char *cp, *resid;
- krb5_error_code err;
+ krb5_error_code err = 0;
cp = strchr (name, ':');
if (!cp) {
@@ -201,7 +201,7 @@
err = k5_mutex_lock(&kt_typehead_lock);
if (err)
- return err;
+ goto cleanup;
tlist = kt_typehead;
/* Don't need to hold the lock, since entries are never modified
or removed once they're in the list. Just need to protect
@@ -209,12 +209,15 @@
k5_mutex_unlock(&kt_typehead_lock);
for (; tlist; tlist = tlist->next) {
if (strcmp (tlist->ops->prefix, pfx) == 0) {
- free(pfx);
- return (*tlist->ops->resolve)(context, resid, ktid);
+ err = (*tlist->ops->resolve)(context, resid, ktid);
+ goto cleanup;
}
}
+ err = KRB5_KT_UNKNOWN_TYPE;
+
+cleanup:
free(pfx);
- return KRB5_KT_UNKNOWN_TYPE;
+ return err;
}
/*
More information about the cvs-krb5
mailing list