Skip to content

Commit 0d2515d

Browse files
committed
Check if TSS_SetMemoryFunctions has already set the memory functions.
1 parent 3a34cab commit 0d2515d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

utils/tssproperties.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,11 @@ TPM_RC TSS_SetMemoryFunctions(TSS_CUST_MALLOC custom_malloc, TSS_CUST_REALLOC cu
584584
TPM_RC rc = 0;
585585

586586
if (custom_malloc == NULL || custom_realloc == NULL || custom_free == NULL) {
587-
rc = TSS_RC_BAD_PROPERTY_VALUE;
587+
rc = TSS_RC_NULL_PARAMETER;
588+
}
589+
590+
if (tssMalloc != NULL || tssRealloc != NULL || tssFree != NULL) {
591+
rc = TSS_RC_PROPERTY_ALREADY_SET;
588592
}
589593

590594
if (rc == 0) {

0 commit comments

Comments
 (0)