git://developer.intra2net.com
/
libi2ncommon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
e613cd7
)
stop leaking FILE* objects when hashing
author
Philipp Gesang
<philipp.gesang@intra2net.com>
Tue, 27 Nov 2018 15:30:41 +0000 (16:30 +0100)
committer
Thomas Jarosch
<thomas.jarosch@intra2net.com>
Tue, 18 Dec 2018 11:57:30 +0000 (12:57 +0100)
In hash_file(), the input FILE* needs freeing when no error
occurred. Do this as soon as it is not needed anymore.
src/crypto.cpp
patch
|
blob
|
blame
|
history
diff --git
a/src/crypto.cpp
b/src/crypto.cpp
index
d08f5d6
..
2aeb614
100644
(file)
--- a/
src/crypto.cpp
+++ b/
src/crypto.cpp
@@
-168,9
+168,10
@@
string I2n::hash_file(string filename, algorithm algo)
}
}
+ fclose(file);
+
if (!EVP_DigestFinal_ex(ctx.get(), ret.get(), &olen))
{
- fclose(file);
throw runtime_error(ERROR_MESSAGE);
}