]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: simplify memory management in processing of unified kernel image a bit
authorLennart Poettering <lennart@poettering.net>
Wed, 20 Jun 2018 21:32:21 +0000 (23:32 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 Oct 2018 14:44:34 +0000 (16:44 +0200)
src/boot/efi/boot.c

index cb041363cdcfa27c2d97789de6eaf01dae120b22..582d34f9838ce2a116bb602e1c91af71bcef50ce 100644 (file)
@@ -1644,15 +1644,16 @@ static VOID config_entry_add_linux(
                 }
 
                 if (os_name && os_id && (os_version || os_build)) {
-                        CHAR16 *conf;
-                        CHAR16 *path;
+                        _cleanup_freepool_ CHAR16 *conf = NULL, *path = NULL;
 
                         conf = PoolPrint(L"%s-%s", os_id, os_version ? : os_build);
                         path = PoolPrint(L"\\EFI\\Linux\\%s", f->FileName);
+
                         entry = config_entry_add_loader(config, loaded_image->DeviceHandle, LOADER_LINUX, conf, 'l', os_name, path);
 
                         FreePool(content);
                         content = NULL;
+
                         /* read the embedded cmdline file */
                         err = file_read(linux_dir, f->FileName, offs[1], szs[1], &content, NULL);
                         if (!EFI_ERROR(err)) {
@@ -1663,9 +1664,6 @@ static VOID config_entry_add_linux(
 
                                 entry->options = stra_to_str(content);
                         }
-
-                        FreePool(conf);
-                        FreePool(path);
                 }
 
                 FreePool(os_name);