diff --git a/scsh/syscalls1.c b/scsh/syscalls1.c index c253239..5515be6 100644 --- a/scsh/syscalls1.c +++ b/scsh/syscalls1.c @@ -335,6 +335,7 @@ s48_value scheme_cwd() { char *buf; int size = scsh_path_max + 1; /* +1 for terminating nul byte... */ + s48_value cwd = S48_UNSPECIFIC; buf = Malloc(char,size); if(!buf) goto lose; @@ -347,8 +348,11 @@ s48_value scheme_cwd() if( !nbuf ) goto lose; buf = nbuf; } - - return s48_enter_string(buf); /* win */ + cwd = s48_enter_string(buf); /* win */ + + Free(buf); + + return cwd; lose: {int e = errno;