When the calculation of md5 read and write files fails, release the hand
le If there is a failure to calculate md5 to read and write files, the hand le will also be released Bug: 1443151 Change-Id: Iabc6fb4f9dec31e9863637ac7671ec74d50d26c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4530264 Commit-Queue: Andrew Grieve <agrieve@chromium.org> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Cr-Commit-Position: refs/heads/main@{#1144124}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
d23b13fbb1
commit
875e7c3062
1
AUTHORS
1
AUTHORS
@@ -475,6 +475,7 @@ Hongbo Min <hongbo.min@intel.com>
|
|||||||
Horia Olaru <horia.olaru@gmail.com>
|
Horia Olaru <horia.olaru@gmail.com>
|
||||||
Horia Olaru <olaru@adobe.com>
|
Horia Olaru <olaru@adobe.com>
|
||||||
Hosung You <hosung.you@samsung.com>
|
Hosung You <hosung.you@samsung.com>
|
||||||
|
Huai Wang <gkvjwa@gmail.com>
|
||||||
Huapeng Li <huapengl@amazon.com>
|
Huapeng Li <huapengl@amazon.com>
|
||||||
Huayong Xu <huayong.xu@samsung.com>
|
Huayong Xu <huayong.xu@samsung.com>
|
||||||
Hung Ngo <ngotienhung195@gmail.com>
|
Hung Ngo <ngotienhung195@gmail.com>
|
||||||
|
@@ -40,6 +40,7 @@ bool MD5Sum(const std::string& path, std::string* digest_string) {
|
|||||||
while ((len = fread(buf.get(), 1, kBufferSize, fd)) > 0)
|
while ((len = fread(buf.get(), 1, kBufferSize, fd)) > 0)
|
||||||
base::MD5Update(&ctx, base::StringPiece(buf.get(), len));
|
base::MD5Update(&ctx, base::StringPiece(buf.get(), len));
|
||||||
if (ferror(fd)) {
|
if (ferror(fd)) {
|
||||||
|
fclose(fd);
|
||||||
std::cerr << "Error reading file " << path << std::endl;
|
std::cerr << "Error reading file " << path << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user