From 21af898e9ce3207baa7f645cf4751976532a6d32 Mon Sep 17 00:00:00 2001
From: Ian Bell <ian.bell@nist.gov>
Date: Sat, 8 May 2021 14:34:21 -0400
Subject: [PATCH] Avoid dangling reference in pure_VLE_T

---
 include/teqp/algorithms/VLE.hpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/teqp/algorithms/VLE.hpp b/include/teqp/algorithms/VLE.hpp
index 0c94243..392ea86 100644
--- a/include/teqp/algorithms/VLE.hpp
+++ b/include/teqp/algorithms/VLE.hpp
@@ -103,7 +103,8 @@ auto do_pure_VLE_T(Residual &resid, Scalar rhoL, Scalar rhoV, int maxiter) {
 
 template<typename Model, typename Scalar>
 auto pure_VLE_T(const Model& model, Scalar T, Scalar rhoL, Scalar rhoV, int maxiter) {
-    return do_pure_VLE_T(IsothermPureVLEResiduals(model, T), rhoL, rhoV, maxiter);
+    auto res = IsothermPureVLEResiduals(model, T);
+    return do_pure_VLE_T(res, rhoL, rhoV, maxiter);
 }
 
 template<typename Model, typename Scalar>
-- 
GitLab