From 20e206a3f61c74d1a2994a614fa7eec49109f995 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 17 Nov 2020 18:08:19 -0500 Subject: fix(tvix): Use mutable field for assigning proto fields This was accidentally using the proto arena API to assign the derivation field of a BuildDerivationRequest. We *thought* this was causing a double free, but even with this change that's still happening. That said, this change is probably still a good idea since it's using the proto API as intended. References: b/64 Change-Id: I950a4eafb214e9113639ea54d2dfd4659b7be931 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2104 Tested-by: BuildkiteCI Reviewed-by: tazjin --- third_party/nix/src/libstore/rpc-store.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/nix/src/libstore/rpc-store.cc b/third_party/nix/src/libstore/rpc-store.cc index 993d111e86..5d0ec1f9eb 100644 --- a/third_party/nix/src/libstore/rpc-store.cc +++ b/third_party/nix/src/libstore/rpc-store.cc @@ -381,8 +381,8 @@ BuildResult RpcStore::buildDerivation(const Path& drvPath, ClientContext ctx; proto::BuildDerivationRequest request; request.mutable_drv_path()->set_path(drvPath); - auto proto_drv = drv.to_proto(); - request.set_allocated_derivation(&proto_drv); + proto::Derivation proto_drv = drv.to_proto(); + *request.mutable_derivation() = proto_drv; request.set_build_mode(BuildModeToProto(buildMode)); // Same note as in ::buildPaths ... -- cgit 1.4.1