diff options
Diffstat (limited to 'host/arch/x86/lib/crossystem_arch.c')
-rw-r--r-- | host/arch/x86/lib/crossystem_arch.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/host/arch/x86/lib/crossystem_arch.c b/host/arch/x86/lib/crossystem_arch.c index d7e89fe1..2b5d00aa 100644 --- a/host/arch/x86/lib/crossystem_arch.c +++ b/host/arch/x86/lib/crossystem_arch.c @@ -170,9 +170,9 @@ int VbReadNvStorage(VbNvContext* vnc) { } -int VbWriteNvStorage(VbNvContext* vnc) { +int VbWriteNvStorage(VbNvContext* vnc) +{ unsigned offs, blksz; - VbSharedDataHeader *sh = VbSharedDataRead(); if (!vnc->raw_changed) return 0; /* Nothing changed, so no need to write */ @@ -189,8 +189,12 @@ int VbWriteNvStorage(VbNvContext* vnc) { return -1; /* Also attempt to write using mosys if using vboot2 */ - if (sh && (sh->flags & VBSD_BOOT_FIRMWARE_VBOOT2)) - VbWriteNvStorage_mosys(vnc); + VbSharedDataHeader *sh = VbSharedDataRead(); + if (sh) { + if (sh->flags & VBSD_BOOT_FIRMWARE_VBOOT2) + VbWriteNvStorage_mosys(vnc); + free(sh); + } return 0; } |