1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-30 23:21:08 +03:00

efivars: un-leak a few strings

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2013-04-03 16:32:01 -04:00
parent d257f05a5f
commit 5483a18693

View File

@ -231,10 +231,12 @@ int efi_get_boot_option(
if (title_size > l - offsetof(struct boot_option, title)) if (title_size > l - offsetof(struct boot_option, title))
return -EINVAL; return -EINVAL;
s = utf16_to_utf8(header->title, title_size); if (title) {
if (!s) { s = utf16_to_utf8(header->title, title_size);
err = -ENOMEM; if (!s) {
goto err; err = -ENOMEM;
goto err;
}
} }
if (header->path_len > 0) { if (header->path_len > 0) {
@ -270,12 +272,13 @@ int efi_get_boot_option(
if (dpath->drive.signature_type != 0x02) if (dpath->drive.signature_type != 0x02)
continue; continue;
efi_guid_to_id128(dpath->drive.signature, &p_uuid); if (part_uuid)
efi_guid_to_id128(dpath->drive.signature, &p_uuid);
continue; continue;
} }
/* Sub-Type 4 File Path */ /* 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); p = utf16_to_utf8(dpath->path, dpath->length-4);
continue; continue;
} }