diff options
| author | Peter Jones <pjones@redhat.com> | 2021-08-03 17:18:25 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-09-07 17:05:04 -0400 |
| commit | 11080efc7416c342b8f26ddb6ea1e8ef21026ddc (patch) | |
| tree | 8801ab58cbf0269b3c8a444f44c3d01f502a5d81 | |
| parent | cae5e2f7c100bc9e8f07de62353021d6737a50ee (diff) | |
| download | efi-boot-shim-11080efc7416c342b8f26ddb6ea1e8ef21026ddc.tar.gz efi-boot-shim-11080efc7416c342b8f26ddb6ea1e8ef21026ddc.zip | |
tpm: free measureddata when SHIM_UNIT_TEST is set
Keep from cluttering up valgrind with allocations that aren't part of
the tested info (yet).
Signed-off-by: Peter Jones <pjones@redhat.com>
| -rw-r--r-- | tpm.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -353,3 +353,25 @@ fallback_should_prefer_reset(void) return EFI_NOT_FOUND; return EFI_SUCCESS; } + +#ifdef SHIM_UNIT_TEST +static void DESTRUCTOR +tpm_clean_up_measurements(void) +{ + for (UINTN i = 0; i < measuredcount; i++) { + VARIABLE_RECORD *vr = &measureddata[i]; + + if (vr->VariableName) + FreePool(vr->VariableName); + if (vr->VendorGuid) + FreePool(vr->VendorGuid); + if (vr->Data) + FreePool(vr->Data); + } + if (measureddata) + FreePool(measureddata); + + measuredcount = 0; + measureddata = NULL; +} +#endif |
