diff liboctave/util/url-transfer.cc @ 25604:ca413f326224

Fix lifetime issues with temporary char arrays returned by get_ASCII_filename (bug #54299). * debug.cc, dlmread.cc, help.cc, load-save.cc, ls-hdf5.cc, urlwrite.cc, ov-java.cc, file-info.cc, url-transfer.cc: Assign return value of get_ASCII_filename to variable to fix lifetime errors with the previous approach.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 13 Jul 2018 19:13:23 +0200
parents d6050ba12c0c
children b2917b7858ba
line wrap: on
line diff
--- a/liboctave/util/url-transfer.cc	Fri Jul 13 09:16:26 2018 -0700
+++ b/liboctave/util/url-transfer.cc	Fri Jul 13 19:13:23 2018 +0200
@@ -202,9 +202,11 @@
               else
                 {
                   // FIXME: Does ascii mode need to be flagged here?
-                  std::ifstream ifile (
-                    octave::sys::get_ASCII_filename (realfile).c_str (),
-                    std::ios::in | std::ios::binary);
+                  std::string ascii_fname
+                    = octave::sys::get_ASCII_filename (realfile);
+
+                  std::ifstream ifile (ascii_fname.c_str (),
+                                       std::ios::in | std::ios::binary);
 
                   if (! ifile.is_open ())
                     {