summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/krb5/krb5.hin2
-rw-r--r--src/lib/krb5/ccache/ccbase.c10
2 files changed, 9 insertions, 3 deletions
diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin
index 0e7fd3fe5d..c28e8571e5 100644
--- a/src/include/krb5/krb5.hin
+++ b/src/include/krb5/krb5.hin
@@ -2284,7 +2284,7 @@ krb5_cc_get_type(krb5_context context, krb5_ccache cache);
* @retval
* 0 Sucess; @a src is freed.
* @return
- * Kerberos error codes; @a src and @a dst are both still allocated.
+ * Kerberos error codes; @a src is still allocated, while @a dst is freed.
*/
krb5_error_code KRB5_CALLCONV
krb5_cc_move(krb5_context context, krb5_ccache src, krb5_ccache dst);
diff --git a/src/lib/krb5/ccache/ccbase.c b/src/lib/krb5/ccache/ccbase.c
index 6a113346a1..69bb8b876b 100644
--- a/src/lib/krb5/ccache/ccbase.c
+++ b/src/lib/krb5/ccache/ccbase.c
@@ -386,9 +386,13 @@ krb5_cc_move(krb5_context context, krb5_ccache src, krb5_ccache dst)
if (!ret) {
ret = krb5_cc_initialize(context, dst, princ);
}
- if (!ret) {
- ret = krb5_cc_lock(context, dst);
+ if (ret) {
+ krb5_cc_unlock(context, src);
+ krb5_cccol_unlock(context);
+ return ret;
}
+
+ ret = krb5_cc_lock(context, dst);
if (!ret) {
ret = krb5_cc_copy_creds(context, src, dst);
krb5_cc_unlock(context, dst);
@@ -397,6 +401,8 @@ krb5_cc_move(krb5_context context, krb5_ccache src, krb5_ccache dst)
krb5_cc_unlock(context, src);
if (!ret) {
ret = krb5_cc_destroy(context, src);
+ } else {
+ ret = krb5_cc_destroy(context, dst);
}
krb5_cccol_unlock(context);
if (princ) {