efi_guid_t guid;
u32 attributes;
bool default_guid, verbose, value_on_memory;
- u16 *var_name16 = NULL, *p;
- size_t len;
+ u16 *var_name16;
efi_status_t ret;
if (argc == 1)
16, 1, value, size, true);
}
- len = utf8_utf16_strnlen(var_name, strlen(var_name));
- var_name16 = malloc((len + 1) * 2);
+ var_name16 = efi_convert_string(var_name);
if (!var_name16) {
printf("## Out of memory\n");
ret = CMD_RET_FAILURE;
goto out;
}
- p = var_name16;
- utf8_utf16_strncpy(&p, var_name, len + 1);
-
ret = efi_set_variable_int(var_name16, &guid, attributes, size, value,
true);
+ free(var_name16);
unmap_sysmem(value);
if (ret == EFI_SUCCESS) {
ret = CMD_RET_SUCCESS;
unmap_sysmem(value);
else
free(value);
- free(var_name16);
return ret;
}