fix missing mutex initialization in keytab file code
authorKen Raeburn <raeburn@mit.edu>
Fri, 26 Nov 2004 06:03:24 +0000 (06:03 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 26 Nov 2004 06:03:24 +0000 (06:03 +0000)
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
src/lib/krb5/keytab/kt_file.c

index 7e8186c6efbccb0320a25024fc323b441d68626d..7907333e02a740a9a791c74988ef79f0a88b05f0 100644 (file)
@@ -1,3 +1,7 @@
+2004-11-26  Ken Raeburn  <raeburn@mit.edu>
+
+       * kt_file.c (krb5_ktfile_wresolve): Initialize mutex here too.
+
 2004-11-23  Ken Raeburn  <raeburn@mit.edu>
 
        * kt_file.c (struct _krb5_ktfile_data): Add mutex and buffer.
index fc33af54ab45a31d9109edf52c026deed35fd2ac..6fb9f7b36af087762dbf578610e47b063a0c2426 100644 (file)
@@ -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);