changeset 28855:644644d17b26

capture variable in lambda expression instead of in unwind_action object * lo-sysdep.cc (octave::sys::putenv_wrapper): Capture new_item in lambda expression instead of in unwind_action object.
author John W. Eaton <jwe@octave.org>
date Mon, 05 Oct 2020 13:57:00 -0400
parents 491433ba8612
children 43ad651cf5a0
files liboctave/system/lo-sysdep.cc
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/system/lo-sysdep.cc	Tue May 12 16:57:31 2020 +0200
+++ b/liboctave/system/lo-sysdep.cc	Mon Oct 05 13:57:00 2020 -0400
@@ -433,8 +433,7 @@
       wchar_t *wnew_item = u8_to_wchar (new_item);
 
       // free new_item, but leak wnew_item (see above)
-      octave::unwind_action free_new_item
-        ([] (char *ptr) { std::free (ptr); }, new_item);
+      octave::unwind_action free_new_item ([=] () { std::free (new_item); });
 
       if (_wputenv (wnew_item) < 0)
         (*current_liboctave_error_handler) ("putenv (%s) failed", new_item);