From 5c68a024070830aaac22267662226af9f4f6b386 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Mon, 17 Jan 2022 11:22:19 -0600 Subject: [PATCH] krb5: FAST: Fix potential double-free Coverity incorrectly thinks this is a NULL dereference after NULL check, but it's not. If anything, this could be a double-free. --- lib/krb5/fast.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/krb5/fast.c b/lib/krb5/fast.c index 5b30f24df..4709aba38 100644 --- a/lib/krb5/fast.c +++ b/lib/krb5/fast.c @@ -225,6 +225,8 @@ make_fast_ap_fxarmor(krb5_context context, KrbFastArmor *fxarmor = NULL; krb5_error_code ret; + *armor = NULL; + ALLOC(fxarmor, 1); if (fxarmor == NULL) { ret = ENOMEM; @@ -429,6 +431,7 @@ _krb5_fast_create_armor(krb5_context context, if (state->armor_data) { free_KrbFastArmor(state->armor_data); free(state->armor_data); + state->armor_data = NULL; } ret = make_fast_ap_fxarmor(context, state, realm, &state->armor_data);