summaryrefslogtreecommitdiff
path: root/util/ecst.c
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2018-07-26 12:22:27 +0200
committerchrome-bot <chrome-bot@chromium.org>2018-07-30 23:08:01 -0700
commiteed612d047e7ce652bb77f4bd9b7d8c0446ca586 (patch)
tree8b87b8b4add03473ede91bfad8971d6f944bfddd /util/ecst.c
parent358464dd972e34208903313b5391960afd065c7d (diff)
downloadchrome-ec-eed612d047e7ce652bb77f4bd9b7d8c0446ca586.tar.gz
util/ecst.c: Fix resource leak
Change-Id: I3397dcaf90c8141efee170183a6e54e8430924f9 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #58168 Reviewed-on: https://chromium-review.googlesource.com/1151124 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'util/ecst.c')
-rwxr-xr-xutil/ecst.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/ecst.c b/util/ecst.c
index 3aebaac99e..e3544bbcaf 100755
--- a/util/ecst.c
+++ b/util/ecst.c
@@ -984,8 +984,10 @@ int copy_file_to_file(char *dst_file_name,
/* Open the source file for read. */
src_file = fopen(src_file_name, "rb");
- if (src_file == NULL)
+ if (src_file == NULL) {
+ fclose(dst_file);
return 0;
+ }
/* Get the source file length in bytes. */
src_file_size = get_file_length(src_file);