about summary refs log tree commit diff
path: root/third_party/nix
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-11-17T23·08-0500
committerglittershark <grfn@gws.fyi>2020-11-19T00·29+0000
commit20e206a3f61c74d1a2994a614fa7eec49109f995 (patch)
treebc430a5d01e6b898fd3b4ec46d37a1deae2a4be1 /third_party/nix
parente1067b1497b3dea0c37ae51bba21f42f1e7d35b5 (diff)
fix(tvix): Use mutable field for assigning proto fields r/1885
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 <mail@tazj.in>
Diffstat (limited to 'third_party/nix')
-rw-r--r--third_party/nix/src/libstore/rpc-store.cc4
1 files 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 993d111e8616..5d0ec1f9ebf4 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 ...