From 3126979ad5d214d7eb31c4242c52bd2edafff50a Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Wed, 3 Apr 2019 22:45:49 -0400 Subject: [PATCH] Fixed memory issue (passing temporary to optional reference) --- gtsam/linear/GaussianBayesNet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gtsam/linear/GaussianBayesNet.cpp b/gtsam/linear/GaussianBayesNet.cpp index 22f1918e4..87e0ded15 100644 --- a/gtsam/linear/GaussianBayesNet.cpp +++ b/gtsam/linear/GaussianBayesNet.cpp @@ -163,7 +163,8 @@ namespace gtsam { return factorGraph.jacobian(ordering); } else { // recursively call with default ordering - return matrix(this->ordering()); + const auto defaultOrdering = this->ordering(); + return matrix(defaultOrdering); } }