diff options
author | Randall Spangler <rspangler@chromium.org> | 2016-09-02 12:25:27 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-09-14 13:05:02 -0700 |
commit | d8a9ede87c0a0b804ef17c60f3b2baac3498f6ae (patch) | |
tree | c88b1a975f5eccc27767cf2e53b224656eafe25f /host/arch/x86/lib/crossystem_arch.c | |
parent | afa7350dccee079673831ef16a7c60a9a74ba77f (diff) | |
download | vboot-d8a9ede87c0a0b804ef17c60f3b2baac3498f6ae.tar.gz |
futility/host lib: Fix coverity warnings
Assorted minor code issues, which we should fix so any new errors stand
out more.
BUG=chromium:643769
BRANCH=none
TEST=make runtests
Change-Id: Ib37b45dea54bd506b519b0304300b8d192e34339
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/382319
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
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; } |