Fix resource leak. Free converted description after printing it.

Also minor style sort of local vars.

CID: 1383606
Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-12-12 19:26:15 +00:00
parent 3af42ca7c1
commit 8354d13d9b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326802

View file

@ -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