about summary refs log tree commit diff
path: root/third_party/nix/src/libutil/hash.cc
diff options
context:
space:
mode:
authorKane York <kanepyork@gmail.com>2020-07-31T23·28-0700
committerkanepyork <rikingcoding@gmail.com>2020-08-01T00·09+0000
commit2a292c71f40f3592e33534ee6d63eb2ca5221d5e (patch)
tree7ec97ce14612333702eb81b35f35a41750bde544 /third_party/nix/src/libutil/hash.cc
parentf41324db8c6e40a23ac4575bf2b0f11ca38a9b65 (diff)
fix(3p/nix/hash): initialize HashSink.ctx r/1514
Fixup for CL 1492 (addcba11b05500ba28ade309de6bd53f8153a6c4)

Additionally, add a test to verify functionality of HashSink.

Change-Id: I2a74b925a1b93ed4d3add29021d759c93e813424
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1507
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party/nix/src/libutil/hash.cc')
-rw-r--r--third_party/nix/src/libutil/hash.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/third_party/nix/src/libutil/hash.cc b/third_party/nix/src/libutil/hash.cc
index e9901d0ccb94..4c6eef0e6d9b 100644
--- a/third_party/nix/src/libutil/hash.cc
+++ b/third_party/nix/src/libutil/hash.cc
@@ -361,7 +361,10 @@ Hash hashFile(HashType ht, const Path& path) {
   return hash;
 }
 
-HashSink::HashSink(HashType ht) : ht(ht), ctx(), bytes(0) { start(ht, *ctx); }
+HashSink::HashSink(HashType ht)
+    : ht(ht), ctx(std::make_unique<hash::Ctx>()), bytes(0) {
+  start(ht, *ctx);
+}
 
 HashSink::~HashSink() { bufPos = 0; }