summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2019-06-20 19:38:17 -0700
committerPatrick Venture <venture@google.com>2019-06-20 19:53:26 -0700
commitde73c3b744b0dad098cd46fecd84eab37ed066be (patch)
tree517824f2189527cd29b4180d15d7b2ef011a7c58 /tools
parent01123b2a5030b643210d7ae4f66c7ca2f0d211f7 (diff)
downloadphosphor-ipmi-flash-de73c3b744b0dad098cd46fecd84eab37ed066be.tar.gz
phosphor-ipmi-flash-de73c3b744b0dad098cd46fecd84eab37ed066be.zip
tools: bugfix: add missing close after failure
Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Id873c41997e2617d1fa3db5767112c23d77c487c
Diffstat (limited to 'tools')
-rw-r--r--tools/handler.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/handler.cpp b/tools/handler.cpp
index 25bb48d..147a457 100644
--- a/tools/handler.cpp
+++ b/tools/handler.cpp
@@ -130,6 +130,7 @@ bool UpdateHandler::verifyFile(const std::string& target)
}
catch (const ipmiblob::BlobException& b)
{
+ blob->closeBlob(session);
throw ToolException("blob exception received: " +
std::string(b.what()));
}
@@ -164,14 +165,23 @@ void UpdateHandler::cleanArtifacts()
session =
blob->openBlob(ipmi_flash::cleanupBlobId,
static_cast<std::uint16_t>(blobs::OpenFlags::write));
+ }
+ catch (...)
+ {
+ return;
+ }
+
+ try
+ {
std::fprintf(stderr, "Committing to the cleanup blob\n");
blob->commit(session, {});
std::fprintf(stderr, "Closing cleanup blob\n");
- blob->closeBlob(session);
}
catch (...)
{
}
+
+ blob->closeBlob(session);
}
} // namespace host_tool
OpenPOWER on IntegriCloud