Skip to content

Commit

Permalink
FIX: force use of setenv function instead of putenv on Posix targets
Browse files Browse the repository at this point in the history
(as `putenv` is causing memory leaks)
  • Loading branch information
Oldes committed Jul 27, 2020
1 parent 5a3cbe5 commit 8d24585
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/include/reb-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,12 @@ These are now obsolete (as of A107) and should be removed:

#ifdef TO_ANY_LINUX
#undef USE_MIDI_DEVICE // Not implemented!
#define USE_SETENV
#endif

#ifdef TO_OSX // OSX/PPC
#define OLD_COMPILER
#define USE_SETENV
#endif

#ifdef TO_OBSD // OpenBSD
Expand Down
4 changes: 2 additions & 2 deletions src/os/posix/host-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ int pipe2(int pipefd[2], int flags); //to avoid "implicit-function-declaration"
***********************************************************************/
{
if (envval) {
#ifdef setenv
#ifdef USE_SETENV
// we pass 1 for overwrite (make call to OS_Get_Env if you
// want to check if already exists)

Expand Down Expand Up @@ -530,7 +530,7 @@ int pipe2(int pipefd[2], int flags); //to avoid "implicit-function-declaration"
return TRUE;
}

#ifdef unsetenv
#ifdef USE_SETENV
if (unsetenv(envname) == -1)
return FALSE;
#else
Expand Down

0 comments on commit 8d24585

Please sign in to comment.