diff libinterp/corefcn/mgorth.cc @ 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 7d6709900da7
children 796f54d4ddbf
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;
     }