svn commit: r326802 - head/usr.sbin/efibootmgr

Warner Losh imp at FreeBSD.org
Tue Dec 12 19:26:18 UTC 2017


Author: imp
Date: Tue Dec 12 19:26:15 2017
New Revision: 326802
URL: https://svnweb.freebsd.org/changeset/base/326802

Log:
  Fix resource leak. Free converted description after printing it.
  Also minor style sort of local vars.
  
  CID: 1383606
  Sponsored by: Netflix

Modified:
  head/usr.sbin/efibootmgr/efibootmgr.c

Modified: head/usr.sbin/efibootmgr/efibootmgr.c
==============================================================================
--- head/usr.sbin/efibootmgr/efibootmgr.c	Tue Dec 12 19:26:10 2017	(r326801)
+++ head/usr.sbin/efibootmgr/efibootmgr.c	Tue Dec 12 19:26:15 2017	(r326802)
@@ -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


More information about the svn-src-all mailing list