mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-08 05:27:35 +02:00
Reverting order of close and free for closing Linux memstreams.
Freeing first causes a segfault when closing a string port. This closes issue 3: http://code.google.com/p/chibi-scheme/issues/detail?id=3
This commit is contained in:
parent
f2e79c3028
commit
ba187ed4ae
1 changed files with 2 additions and 2 deletions
4
eval.c
4
eval.c
|
@ -1969,10 +1969,10 @@ static sexp sexp_close_port (sexp ctx, sexp port) {
|
|||
return sexp_type_exception(ctx, "not a port", port);
|
||||
if (! sexp_port_openp(port))
|
||||
return sexp_user_exception(ctx, SEXP_FALSE, "port already closed", port);
|
||||
if (sexp_port_buf(port))
|
||||
free(sexp_port_buf(port));
|
||||
if (sexp_port_stream(port))
|
||||
fclose(sexp_port_stream(port));
|
||||
if (sexp_port_buf(port))
|
||||
free(sexp_port_buf(port));
|
||||
sexp_port_openp(port) = 0;
|
||||
return SEXP_VOID;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue