diff --git a/sexp.c b/sexp.c index d061e912..c7032a06 100644 --- a/sexp.c +++ b/sexp.c @@ -144,7 +144,7 @@ sexp sexp_finalize_port (sexp ctx, sexp self, sexp_sint_t n, sexp port) { /* close the stream */ fclose(sexp_port_stream(port)); /* free the buffer if allocated */ - if (sexp_port_buf(port) && sexp_oportp(port) + if (sexp_port_buf(port) && sexp_oportp(port) && sexp_vectorp(sexp_port_cookie(port)) #if !SEXP_USE_STRING_STREAMS && !sexp_port_customp(port) #endif