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:
imp 2017-12-12 19:26:15 +00:00
parent 22bccd4c7f
commit 3734655b60

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