Fixed memory leak in scheme_cwd: a temporary buffer was not freed

after entering the value in the scheme heap.
This commit is contained in:
mainzelm 2003-10-13 09:50:30 +00:00
parent be8a63dbe8
commit 1521521116
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}
cwd = s48_enter_string(buf); /* win */
return s48_enter_string(buf); /* win */
Free(buf);
return cwd;
lose:
{int e = errno;