diff liboctave/system/lo-sysdep.cc @ 28852:fe0298edc04d

Fix compilation error with lambda expression. * lo-sysdep.cc (putenv_wrapper): Fix type and constness of lambda parameter. Add comment to indicate memory leak.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 02 Oct 2020 23:20:11 +0200
parents 1ac5a76ae91d
children 644644d17b26
line wrap: on
line diff
--- a/liboctave/system/lo-sysdep.cc	Fri Oct 02 13:25:00 2020 -0400
+++ b/liboctave/system/lo-sysdep.cc	Fri Oct 02 23:20:11 2020 +0200
@@ -431,8 +431,10 @@
 
 #if defined (OCTAVE_USE_WINDOWS_API)
       wchar_t *wnew_item = u8_to_wchar (new_item);
+
+      // free new_item, but leak wnew_item (see above)
       octave::unwind_action free_new_item
-        ([] (const wchar_t *ptr) { std::free (ptr); }, new_item);
+        ([] (char *ptr) { std::free (ptr); }, new_item);
 
       if (_wputenv (wnew_item) < 0)
         (*current_liboctave_error_handler) ("putenv (%s) failed", new_item);