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

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