From b72a5d25e68d9bc2eecacffba5563eaa5c429ba0 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Fri, 26 Nov 2004 06:03:24 +0000 Subject: [PATCH] fix missing mutex initialization in keytab file code Missed a case in the checked-in (and pulled-up) fix to 2781. * kt_file.c (krb5_ktfile_wresolve): Initialize mutex here too. ticket: new status: open target_version: 1.4 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16908 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/keytab/ChangeLog | 4 ++++ src/lib/krb5/keytab/kt_file.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/lib/krb5/keytab/ChangeLog b/src/lib/krb5/keytab/ChangeLog index 7e8186c6e..7907333e0 100644 --- a/src/lib/krb5/keytab/ChangeLog +++ b/src/lib/krb5/keytab/ChangeLog @@ -1,3 +1,7 @@ +2004-11-26 Ken Raeburn + + * kt_file.c (krb5_ktfile_wresolve): Initialize mutex here too. + 2004-11-23 Ken Raeburn * kt_file.c (struct _krb5_ktfile_data): Add mutex and buffer. diff --git a/src/lib/krb5/keytab/kt_file.c b/src/lib/krb5/keytab/kt_file.c index fc33af54a..6fb9f7b36 100644 --- a/src/lib/krb5/keytab/kt_file.c +++ b/src/lib/krb5/keytab/kt_file.c @@ -793,6 +793,7 @@ krb5_error_code KRB5_CALLCONV krb5_ktfile_wresolve(krb5_context context, const char *name, krb5_keytab *id) { krb5_ktfile_data *data; + krb5_error_code err; if ((*id = (krb5_keytab) malloc(sizeof(**id))) == NULL) return(ENOMEM); @@ -803,7 +804,14 @@ krb5_ktfile_wresolve(krb5_context context, const char *name, krb5_keytab *id) return(ENOMEM); } + err = k5_mutex_init(&data->lock); + if (err) { + krb5_xfree(*id); + return err; + } + if ((data->name = (char *)calloc(strlen(name) + 1, sizeof(char))) == NULL) { + k5_mutex_destroy(&data->lock); krb5_xfree(data); krb5_xfree(*id); return(ENOMEM); -- 2.26.2