Fix profile_abandon() management lib_handle lock
authorGreg Hudson <ghudson@mit.edu>
Thu, 21 Jul 2011 18:17:38 +0000 (18:17 +0000)
committerGreg Hudson <ghudson@mit.edu>
Thu, 21 Jul 2011 18:17:38 +0000 (18:17 +0000)
It wasn't unlocking the mutex after decrementing the refcount and
wasn't destroying the mutex before freeing the handle.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25031 dc483132-0cff-0310-8789-dd5450dbe970

src/util/profile/prof_init.c

index 959598e42a7adf8033d6464a7ba845ad68c980a8..bbb7f88fd34c31e6cf711529e471281ce43d98c2 100644 (file)
@@ -481,8 +481,11 @@ profile_abandon(profile_t profile)
             err = k5_mutex_lock(&profile->lib_handle->lock);
             if (!err && --profile->lib_handle->refcount == 0) {
                 krb5int_close_plugin(profile->lib_handle->plugin_handle);
+                k5_mutex_unlock(&profile->lib_handle->lock);
+                k5_mutex_destroy(&profile->lib_handle->lock);
                 free(profile->lib_handle);
-            }
+            } else if (!err)
+                k5_mutex_unlock(&profile->lib_handle->lock);
         }
         free(profile->vt);
     } else {