changeset 30403:4f8284dee449 stable

mgorth: Avoid possible lifetime issue with temporary variable (bug #57591). * libinterp/corefcn/mgorth.cc (do_mgorth): Avoid possible issue with lifetime of temporary variable by assigning to a local variable with defined scope.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 30 Nov 2021 08:54:58 +0100
parents 168da23530b4
children 64d8e7c98a2f 20cefb3b0da6
files libinterp/corefcn/mgorth.cc
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/mgorth.cc	Mon Nov 29 16:43:46 2021 -0800
+++ b/libinterp/corefcn/mgorth.cc	Tue Nov 30 08:54:58 2021 +0100
@@ -43,7 +43,8 @@
   for (octave_idx_type j = 0; j < Vc; j++)
     {
       ColumnVector Vcj = V.column (j);
-      h(j) = RowVector (Vcj.hermitian ()) * x;
+      RowVector Vcjh = Vcj.hermitian ();
+      h(j) = Vcjh * x;
       x -= h(j) * Vcj;
     }