Blame SOURCES/0016-FAPI-Clean-up-memory-when-Fapi_Delete_Async-failed.patch

897056
From 80d8aa8e3d15fd01eacb40200b80a83ed940c207 Mon Sep 17 00:00:00 2001
897056
From: JerryDevis <857869045@qq.com>
897056
Date: Sun, 9 Jan 2022 16:31:09 +0800
897056
Subject: [PATCH 16/23] FAPI: Clean up memory when Fapi_Delete_Async failed
897056
897056
Signed-off-by: JerryDevis <857869045@qq.com>
897056
---
897056
 src/tss2-fapi/api/Fapi_Delete.c | 10 +++++-----
897056
 1 file changed, 5 insertions(+), 5 deletions(-)
897056
897056
diff --git a/src/tss2-fapi/api/Fapi_Delete.c b/src/tss2-fapi/api/Fapi_Delete.c
897056
index 43ea0332..2b5826ab 100644
897056
--- a/src/tss2-fapi/api/Fapi_Delete.c
897056
+++ b/src/tss2-fapi/api/Fapi_Delete.c
897056
@@ -419,14 +419,14 @@ Fapi_Delete_Async(
897056
         /* No session will be needed these files can be deleted without
897056
            interaction with the TPM */
897056
         r = ifapi_non_tpm_mode_init(context);
897056
-        return_if_error(r, "Initialize Entity_Delete");
897056
+        goto_if_error(r, "Initialize Entity_Delete", error_cleanup);
897056
         context->session1 = ESYS_TR_NONE;
897056
 
897056
         context->state = ENTITY_DELETE_GET_FILE;
897056
     } else {
897056
         /* Check whether TCTI and ESYS are initialized */
897056
-        return_if_null(context->esys, "Command can't be executed in none TPM mode.",
897056
-                       TSS2_FAPI_RC_NO_TPM);
897056
+        goto_if_null(context->esys, "Command can't be executed in none TPM mode.",
897056
+                       TSS2_FAPI_RC_NO_TPM, error_cleanup);
897056
 
897056
         /* If the async state automata of FAPI shall be tested, then we must not set
897056
            the timeouts of ESYS to blocking mode.
897056
@@ -435,12 +435,12 @@ Fapi_Delete_Async(
897056
            to block until a result is available. */
897056
 #ifndef TEST_FAPI_ASYNC
897056
         r = Esys_SetTimeout(context->esys, TSS2_TCTI_TIMEOUT_BLOCK);
897056
-        return_if_error_reset_state(r, "Set Timeout to blocking");
897056
+        goto_if_error_reset_state(r, "Set Timeout to blocking", error_cleanup);
897056
 #endif /* TEST_FAPI_ASYNC */
897056
 
897056
         /* A TPM session will be created to enable object authorization */
897056
         r = ifapi_session_init(context);
897056
-        return_if_error(r, "Initialize Entity_Delete");
897056
+        goto_if_error(r, "Initialize Entity_Delete", error_cleanup);
897056
 
897056
         r = ifapi_get_sessions_async(context,
897056
                                  IFAPI_SESSION_GENEK | IFAPI_SESSION1,
897056
-- 
897056
2.34.3
897056