Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Dec 2017 19:26:15 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326802 - head/usr.sbin/efibootmgr
Message-ID:  <201712121926.vBCJQFJf026268@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712121926.vBCJQFJf026268>