[spirv-writer] Fixing memory leaks in texture intrinsics tests

The variables are no longer released.

Bug: tint:143
Change-Id: I56a3edd0e7acb3c729aa82851879d69e510298db
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/28164
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Tomek Ponitka <tommek@google.com>
diff --git a/src/writer/spirv/builder_intrinsic_test.cc b/src/writer/spirv/builder_intrinsic_test.cc
index 8027b81..dc1cbef 100644
--- a/src/writer/spirv/builder_intrinsic_test.cc
+++ b/src/writer/spirv/builder_intrinsic_test.cc
@@ -471,12 +471,13 @@
   void add_call_param(std::string name,
                       ast::type::Type* type,
                       ast::ExpressionList* call_params) {
-    auto var =
-        std::make_unique<ast::Variable>(name, ast::StorageClass::kNone, type);
-    td()->RegisterVariableForTesting(var.get());
+    variables_.push_back(
+        std::make_unique<ast::Variable>(name, ast::StorageClass::kNone, type));
+    td()->RegisterVariableForTesting(variables_.back().get());
 
     call_params->push_back(std::make_unique<ast::IdentifierExpression>(name));
-    ASSERT_TRUE(b()->GenerateGlobalVariable(var.release())) << b()->error();
+    ASSERT_TRUE(b()->GenerateGlobalVariable(variables_.back().get()))
+        << b()->error();
   }
 
   std::unique_ptr<ast::type::Type> subtype(TextureType type) {
@@ -556,6 +557,7 @@
   ast::Module mod_;
   std::unique_ptr<TypeDeterminer> td_;
   std::unique_ptr<Builder> b_;
+  std::vector<std::unique_ptr<ast::Variable>> variables_;
 };
 
 class Builder_TextureLoad : public Builder_TextureOperation {