summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-03 16:32:01 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-04 22:46:19 -0400
commit5483a18693871e67cff6d85e43ca843cd976d019 (patch)
treecc4336a2d09a25d996baa619f63d5e9336ea8fcf
parentd257f05a5f9710c9e6ca558fbabc77e504ca8668 (diff)
efivars: un-leak a few strings
-rw-r--r--src/shared/efivars.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 06cf127de1..8d004bad33 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -231,10 +231,12 @@ int efi_get_boot_option(
if (title_size > l - offsetof(struct boot_option, title))
return -EINVAL;
- s = utf16_to_utf8(header->title, title_size);
- if (!s) {
- err = -ENOMEM;
- goto err;
+ if (title) {
+ s = utf16_to_utf8(header->title, title_size);
+ if (!s) {
+ err = -ENOMEM;
+ goto err;
+ }
}
if (header->path_len > 0) {
@@ -270,12 +272,13 @@ int efi_get_boot_option(
if (dpath->drive.signature_type != 0x02)
continue;
- efi_guid_to_id128(dpath->drive.signature, &p_uuid);
+ if (part_uuid)
+ efi_guid_to_id128(dpath->drive.signature, &p_uuid);
continue;
}
/* Sub-Type 4 – File Path */
- if (dpath->sub_type == 0x04) {
+ if (dpath->sub_type == 0x04 && !p && path) {
p = utf16_to_utf8(dpath->path, dpath->length-4);
continue;
}