summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-04-02 14:50:36 +0200
committerLennart Poettering <lennart@poettering.net>2019-04-02 14:54:42 +0200
commitc1db999eb8774463ce1fe3fe24e7fffbdc1ccb16 (patch)
treeb5e34f355f2fc35741ca8ed114978d8a0111034f
parenta7798cd81b11205811e8d6e848e23b8b285f2bd8 (diff)
downloadsystemd-c1db999eb8774463ce1fe3fe24e7fffbdc1ccb16.tar.gz
boot: use TAKE_PTR() where appropriate
-rw-r--r--src/boot/efi/boot.c21
-rw-r--r--src/boot/efi/util.c3
2 files changed, 8 insertions, 16 deletions
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c
index 7b3e782454..57c423bfb6 100644
--- a/src/boot/efi/boot.c
+++ b/src/boot/efi/boot.c
@@ -269,10 +269,8 @@ static BOOLEAN line_edit(
case KEYPRESS(0, 0, CHAR_LINEFEED):
case KEYPRESS(0, 0, CHAR_CARRIAGE_RETURN):
- if (StrCmp(line, line_in) != 0) {
- *line_out = line;
- line = NULL;
- }
+ if (StrCmp(line, line_in) != 0)
+ *line_out = TAKE_PTR(line);
enter = TRUE;
exit = TRUE;
break;
@@ -1258,8 +1256,7 @@ static VOID config_entry_bump_counters(
/* If the file we just renamed is the loader path, then let's update that. */
if (StrCmp(entry->loader, old_path) == 0) {
FreePool(entry->loader);
- entry->loader = new_path;
- new_path = NULL;
+ entry->loader = TAKE_PTR(new_path);
}
}
@@ -1360,10 +1357,8 @@ static VOID config_entry_add_from_file(
s = PoolPrint(L"%s %s", entry->options, new);
FreePool(entry->options);
entry->options = s;
- } else {
- entry->options = new;
- new = NULL;
- }
+ } else
+ entry->options = TAKE_PTR(new);
continue;
}
@@ -1382,10 +1377,8 @@ static VOID config_entry_add_from_file(
s = PoolPrint(L"%s %s", initrd, entry->options);
FreePool(entry->options);
entry->options = s;
- } else {
- entry->options = initrd;
- initrd = NULL;
- }
+ } else
+ entry->options = TAKE_PTR(initrd);
}
entry->device = device;
diff --git a/src/boot/efi/util.c b/src/boot/efi/util.c
index bc1d4ae5c4..4134e2200a 100644
--- a/src/boot/efi/util.c
+++ b/src/boot/efi/util.c
@@ -122,8 +122,7 @@ EFI_STATUS efivar_get(const CHAR16 *name, CHAR16 **value) {
/* Return buffer directly if it happens to be NUL terminated already */
if (size >= 2 && buf[size-2] == 0 && buf[size-1] == 0) {
- *value = (CHAR16*) buf;
- buf = NULL;
+ *value = (CHAR16*) TAKE_PTR(buf);
return EFI_SUCCESS;
}