Mercurial > octave
changeset 21444:74b07936fd05
lo-utils.cc: Add note about inevitable memory leak from using putenv.
* lo-utils.cc: Add note about inevitable memory leak from using putenv.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 13 Mar 2016 07:34:27 -0700 |
parents | acd6e203031d |
children | de155ca994d4 |
files | liboctave/util/lo-utils.cc |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/util/lo-utils.cc Fri Mar 11 17:12:17 2016 -0800 +++ b/liboctave/util/lo-utils.cc Sun Mar 13 07:34:27 2016 -0700 @@ -97,6 +97,9 @@ { int new_len = name.length () + value.length () + 2; + // FIXME: This leaks memory, but so would a call to setenv. + // Short of extreme measures to track memory, altering the environment + // always leaks memory, but the saving grace is that the leaks are small. char *new_item = static_cast<char*> (gnulib::malloc (new_len)); sprintf (new_item, "%s=%s", name.c_str (), value.c_str ());