aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-12-12 19:26:15 +0000
committerWarner Losh <imp@FreeBSD.org>2017-12-12 19:26:15 +0000
commit8354d13d9bd6b826b062948216c9a285a9cb7dd3 (patch)
treeb3686840b661de1b6f9686386d7cd1029f3c0e53
parent3af42ca7c1b64ed62388d25d18d0ac0ab7b38c9a (diff)
downloadsrc-8354d13d9bd6b826b062948216c9a285a9cb7dd3.tar.gz
src-8354d13d9bd6b826b062948216c9a285a9cb7dd3.zip
Fix resource leak. Free converted description after printing it.
Also minor style sort of local vars. CID: 1383606 Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=326802
-rw-r--r--usr.sbin/efibootmgr/efibootmgr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c
index 5439cba5aa26..4eb1b644e07c 100644
--- a/usr.sbin/efibootmgr/efibootmgr.c
+++ b/usr.sbin/efibootmgr/efibootmgr.c
@@ -783,9 +783,10 @@ print_boot_vars(bool verbose)
* as a command epilogue
*/
struct entry *v;
- uint32_t attrs, load_attrs;
uint8_t *data;
+ char *d;
size_t size;
+ uint32_t attrs, load_attrs;
int ret;
ret = efi_get_variable(EFI_GLOBAL_GUID, "BootNext", &data, &size, &attrs);
@@ -812,9 +813,9 @@ print_boot_vars(bool verbose)
if (ret < 0)
continue; /* we must have deleted it */
load_attrs = le32dec(data);
+ d = get_descr(data);
printf("%s%c %s", v->name,
- ((load_attrs & LOAD_OPTION_ACTIVE) ? '*': ' '),
- get_descr(data));
+ ((load_attrs & LOAD_OPTION_ACTIVE) ? '*': ' '), d);
if (verbose)
print_loadopt_str(data, size);
else