diff options
author | Patrick Georgi <pgeorgi@google.com> | 2017-10-05 15:40:02 +0200 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-14 08:03:05 -0700 |
commit | 57ae0b0f18b7bb0360436143374065f17d675282 (patch) | |
tree | 736b0c404880a1d4bdadbcc134189773012a73d3 | |
parent | 8373a0f86c24f17bdc21fff0f59044828923c49d (diff) | |
download | chrome-ec-57ae0b0f18b7bb0360436143374065f17d675282.tar.gz |
util/iteflash.c: Handle potential resource leaks
They're of really little consequence right now since an error in
verify_flash() is only followed by resource tear down and process exit.
verify_flash could gain other call-sites though, so better be safe than
sorry.
BUG=none
BRANCH=none
TEST=none
Change-Id: I5fa8276dc3b3e124dacceca1ea857430982f7567
Found-by: Coverity Scan #141761, #141762
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/702482
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Chris Ching <chingcodes@chromium.org>
-rw-r--r-- | util/iteflash.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/util/iteflash.c b/util/iteflash.c index cb583af64e..3011600f3f 100644 --- a/util/iteflash.c +++ b/util/iteflash.c @@ -903,6 +903,8 @@ int verify_flash(struct ftdi_context *ftdi, const char *filename, if (!buffer || !buffer2) { fprintf(stderr, "Cannot allocate %d bytes\n", flash_size); + free(buffer); + free(buffer2); return -ENOMEM; } |