aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/hash/par_hash
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-07-19 18:17:19 +0200
committerDaniel Neus <[email protected]>2016-07-20 14:56:18 +0200
commit8f53d3f6efd1419e8feac027035fc8d407e1e75f (patch)
treefc3060e3414f3dc3d562e43c6879f7a6dbdfc298 /src/lib/hash/par_hash
parent308c7d5eda678566edd26e9ab20edbe772f46363 (diff)
improve parallel hash tests + memory leak fix
- add one test with SHA-256,SHA-512 - test Parallel::clone() - test Parallel ctor - fix memory leak in Parallel::clone(): Currently Parallel::clone() calls hash->clone() (first heap allocation) and after this clone() calls Parallel(const std::vector<HashFunction*>& in) which does another heap allocation. So its sufficient to pass the hash pointer to the Parallel ctor instead of a clone
Diffstat (limited to 'src/lib/hash/par_hash')
-rw-r--r--src/lib/hash/par_hash/par_hash.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/hash/par_hash/par_hash.cpp b/src/lib/hash/par_hash/par_hash.cpp
index 5645a99c7..f6bed96ee 100644
--- a/src/lib/hash/par_hash/par_hash.cpp
+++ b/src/lib/hash/par_hash/par_hash.cpp
@@ -68,7 +68,7 @@ HashFunction* Parallel::clone() const
std::vector<HashFunction*> hash_copies;
for(auto&& hash : m_hashes)
- hash_copies.push_back(hash->clone());
+ hash_copies.push_back(hash.get());
return new Parallel(hash_copies);
}