changeset 19574:146f1daa805b

avoid valgrind warnings about using freed memory * sysdep.cc (Funsetenv): Explicitly create temporary std::string object.
author John W. Eaton <jwe@octave.org>
date Wed, 07 Jan 2015 13:23:26 -0500
parents 3b0a9a832360
children 04d6d592c614
files libinterp/corefcn/sysdep.cc
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/sysdep.cc	Mon Jan 05 17:44:00 2015 -0500
+++ b/libinterp/corefcn/sysdep.cc	Wed Jan 07 13:23:26 2015 -0500
@@ -683,11 +683,11 @@
 
   if (nargin == 1)
     {
-      const char *var = args(0).string_value ().c_str ();
+      std::string tmp = args(0).string_value ();
 
       if (! error_state)
         {
-          int status = gnulib::unsetenv (var);
+          int status = gnulib::unsetenv (tmp.c_str ());
           retval = status;
         }
     }