If the malloc fails for event->rgbPcrValue free gets
called for event, but pointer doesn't get set to NULL.
In the cleanup code at the end of the function if event
is not NULL, it will attempt to free event->rgbPcrValue
and event->rgbEvent.

Signed-off-by: Jerry Snitselaar <[email protected]>
---
 src/tcs/tcs_evlog_imaem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/tcs/tcs_evlog_imaem.c b/src/tcs/tcs_evlog_imaem.c
index d158330..33af283 100644
--- a/src/tcs/tcs_evlog_imaem.c
+++ b/src/tcs/tcs_evlog_imaem.c
@@ -259,6 +259,7 @@ ima_get_entry(FILE *handle, UINT32 pcr_index, UINT32 *num, 
TSS_PCR_EVENT **ppEve
                                if (event->rgbPcrValue == NULL) {
                                        LogError("malloc of %d bytes failed.", 
20);
                                        free(event);
+                                       event = NULL;
                                        result = TCSERR(TSS_E_OUTOFMEMORY);
                                        goto done;
                                }
-- 
2.20.1.98.gecbdaf0899



_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech

Reply via email to