fix(3p/nix/hash): initialize HashSink.ctx
Fixup for CL 1492 (addcba11b0)
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>
This commit is contained in:
parent
f41324db8c
commit
2a292c71f4
2 changed files with 22 additions and 1 deletions
5
third_party/nix/src/libutil/hash.cc
vendored
5
third_party/nix/src/libutil/hash.cc
vendored
|
|
@ -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; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue