Free memory buffer after closing port

This commit is contained in:
Justin Ethier 2016-08-25 23:58:40 -04:00
parent 4a2ef06b17
commit 1e2dac3026

View file

@ -2442,6 +2442,12 @@ object Cyc_io_close_port(void *data, object port)
if (stream)
fclose(stream);
((port_type *) port)->fp = NULL;
if (((port_type *)port)->mem_buf != NULL){
free( ((port_type *)port)->mem_buf );
((port_type *)port)->mem_buf = NULL;
((port_type *)port)->mem_buf_len = 0;
}
}
return port;
}