Skip to content

Commit

Permalink
TCTI: Fix leak produced in Tss2_TctiLdr_Initialize_Ex
Browse files Browse the repository at this point in the history
The return code of tctildr_init_context_data was not checked in
Tss2_TctiLdr_Initialize_Ex. The cleanup part of this function was
not executed and so a leak was produced.
Fixes #2842

Signed-off-by: Juergen Repp <juergen_repp@web.de>
  • Loading branch information
JuergenReppSIT committed May 18, 2024
1 parent a19ac4c commit 0090da0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tss2-tcti/tctildr.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,10 @@ Tss2_TctiLdr_Initialize_Ex (const char *name,
}

*tctiContext = (TSS2_TCTI_CONTEXT *) ldr_ctx;
return tctildr_init_context_data(*tctiContext, local_name, local_conf);
rc = tctildr_init_context_data(*tctiContext, local_name, local_conf);
if (rc == TSS2_RC_SUCCESS) {
return rc;
}

err:
if (*tctiContext != NULL) {
Expand Down Expand Up @@ -577,7 +580,6 @@ TSS2_RC Tss2_Tcti_TctiLdr_Init (TSS2_TCTI_CONTEXT *tctiContext, size_t *size,
if (rc != TSS2_RC_SUCCESS) {
goto free_name_conf;
}

rc = tctildr_init_context_data(tctiContext, name, conf);

free_name_conf:
Expand Down

0 comments on commit 0090da0

Please sign in to comment.