From b9567cb15825f0d7fb7d75eb6fbc005358cf5b92 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 May 2010 10:28:39 -0400 Subject: [PATCH] Don't attempt to release unallocated resource in fcc_move() --- lib/krb5/fcache.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/krb5/fcache.c b/lib/krb5/fcache.c index 67c4c7444..854ee35ac 100644 --- a/lib/krb5/fcache.c +++ b/lib/krb5/fcache.c @@ -990,11 +990,12 @@ fcc_move(krb5_context context, krb5_ccache from, krb5_ccache to) { krb5_storage *sp; int fd; - ret = init_fcc (context, to, &sp, &fd, NULL); - if (sp) - krb5_storage_free(sp); - fcc_unlock(context, fd); - close(fd); + if ((ret = init_fcc (context, to, &sp, &fd, NULL)) == 0) { + if (sp) + krb5_storage_free(sp); + fcc_unlock(context, fd); + close(fd); + } } fcc_close(context, from); @@ -1041,7 +1042,7 @@ static krb5_error_code fcc_get_kdc_offset(krb5_context context, krb5_ccache id, krb5_deltat *kdc_offset) { krb5_error_code ret; - krb5_storage *sp; + krb5_storage *sp = NULL; int fd; ret = init_fcc(context, id, &sp, &fd, kdc_offset); if (sp)