krb5: Fix acc_move() crash (CCAPI)

This commit is contained in:
Nicolas Williams
2022-02-10 19:08:10 -06:00
parent b92cf79543
commit 6b39972113

View File

@@ -985,6 +985,7 @@ acc_end_cache_get(krb5_context context, krb5_cc_cursor cursor)
static krb5_error_code KRB5_CALLCONV static krb5_error_code KRB5_CALLCONV
acc_move(krb5_context context, krb5_ccache from, krb5_ccache to) acc_move(krb5_context context, krb5_ccache from, krb5_ccache to)
{ {
krb5_error_code ret;
krb5_acc *afrom = ACACHE(from); krb5_acc *afrom = ACACHE(from);
krb5_acc *ato = ACACHE(to); krb5_acc *ato = ACACHE(to);
int32_t error; int32_t error;
@@ -1008,9 +1009,10 @@ acc_move(krb5_context context, krb5_ccache from, krb5_ccache to)
} }
error = (*ato->ccache->func->move)(afrom->ccache, ato->ccache); error = (*ato->ccache->func->move)(afrom->ccache, ato->ccache);
ret = translate_cc_error(context, error);
if (ret == 0)
krb5_cc_destroy(context, from); krb5_cc_destroy(context, from);
return translate_cc_error(context, error); return ret;
} }
static krb5_error_code KRB5_CALLCONV static krb5_error_code KRB5_CALLCONV