summaryrefslogtreecommitdiff
path: root/lib/efi_selftest/efi_selftest_manageprotocols.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2018-08-26 14:58:16 +0200
committerAlexander Graf <agraf@suse.de>2018-09-23 21:55:28 +0200
commite470efd2d909ace1cae328d62d56d2a0c0c00462 (patch)
tree7bba036fb30965bc739d2a135685e45643193a60 /lib/efi_selftest/efi_selftest_manageprotocols.c
parent9dc8d155d4e88563f572ee79aab758eb4272f3fd (diff)
efi_selftest: memory leak testing manage protocols
Remove memory leak in efi_selftest_manageprotocols.c. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_selftest/efi_selftest_manageprotocols.c')
-rw-r--r--lib/efi_selftest/efi_selftest_manageprotocols.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/efi_selftest/efi_selftest_manageprotocols.c b/lib/efi_selftest/efi_selftest_manageprotocols.c
index 44b8da3ba5..b09e4cdcfa 100644
--- a/lib/efi_selftest/efi_selftest_manageprotocols.c
+++ b/lib/efi_selftest/efi_selftest_manageprotocols.c
@@ -179,7 +179,12 @@ static int execute(void)
efi_st_error("LocateHandleBuffer failed to locate new handle\n");
return EFI_ST_FAILURE;
}
- boottime->set_mem(buffer, sizeof(efi_handle_t) * buffer_size, 0);
+ /* Release buffer */
+ ret = boottime->free_pool(buffer);
+ if (ret != EFI_SUCCESS) {
+ efi_st_error("FreePool failed\n");
+ return EFI_ST_FAILURE;
+ }
/*
* Test error handling in UninstallMultipleProtocols
@@ -221,6 +226,7 @@ static int execute(void)
efi_st_error("LocateHandleBuffer failed to locate new handle\n");
return EFI_ST_FAILURE;
}
+ /* Clear the buffer, we are reusing it it the next step. */
boottime->set_mem(buffer, sizeof(efi_handle_t) * buffer_size, 0);
/*
@@ -248,7 +254,12 @@ static int execute(void)
efi_st_error("LocateHandle failed to locate new handles\n");
return EFI_ST_FAILURE;
}
- boottime->set_mem(buffer, sizeof(efi_handle_t) * buffer_size, 0);
+ /* Release buffer */
+ ret = boottime->free_pool(buffer);
+ if (ret != EFI_SUCCESS) {
+ efi_st_error("FreePool failed\n");
+ return EFI_ST_FAILURE;
+ }
/*
* Test LocateProtocol
@@ -319,6 +330,12 @@ static int execute(void)
efi_st_error("Failed to get protocols per handle\n");
return EFI_ST_FAILURE;
}
+ /* Release buffer */
+ ret = boottime->free_pool(prot_buffer);
+ if (ret != EFI_SUCCESS) {
+ efi_st_error("FreePool failed\n");
+ return EFI_ST_FAILURE;
+ }
/*
* Uninstall remaining protocols