summaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2015-02-24 23:57:47 +0100
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2015-02-25 00:00:32 +0100
commit7cb0f263adacbd12f5be4f7f23d7f596485adb37 (patch)
tree61d25ce241068ddc16f36e9ba0ee433d0f99a539 /src/boot
parent858a109f4a336be6c258ae615d31651347b9b67b (diff)
bootctl: fix mem leaks
CID#1271347/1271348
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/bootctl.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c
index 96637f12c6..fb568bebbe 100644
--- a/src/boot/bootctl.c
+++ b/src/boot/bootctl.c
@@ -365,15 +365,15 @@ static int status_binaries(const char *esp_path, sd_id128_t partition) {
}
static int print_efi_option(uint16_t id, bool in_order) {
- char *title = NULL;
- char *path = NULL;
+ _cleanup_free_ char *title = NULL;
+ _cleanup_free_ char *path = NULL;
sd_id128_t partition;
bool active;
int r = 0;
r = efi_get_boot_option(id, &title, &partition, &path, &active);
if (r < 0)
- goto finish;
+ return r;
/* print only configured entries with partition information */
if (!path || sd_id128_equal(partition, SD_ID128_NULL))
@@ -388,10 +388,7 @@ static int print_efi_option(uint16_t id, bool in_order) {
printf(" File: └─%s\n", path);
printf("\n");
-finish:
- free(title);
- free(path);
- return r;
+ return 0;
}
static int status_variables(void) {
@@ -896,7 +893,7 @@ finish:
}
static int remove_from_order(uint16_t slot) {
- uint16_t *order = NULL;
+ _cleanup_free_ uint16_t *order = NULL;
int n_order;
int i;
int err = 0;
@@ -917,7 +914,6 @@ static int remove_from_order(uint16_t slot) {
break;
}
- free(order);
return err;
}