diff --git a/gc.c b/gc.c index 455499e9..0d039693 100644 --- a/gc.c +++ b/gc.c @@ -495,6 +495,8 @@ char *gc_copy_obj(object dest, char *obj, gc_thread_data * thd) hp->tok_buf_len = ((port_type *) obj)->tok_buf_len; hp->mem_buf = ((port_type *)obj)->mem_buf; hp->mem_buf_len = ((port_type *)obj)->mem_buf_len; + hp->str_bv_in_mem_buf = ((port_type *)obj)->str_bv_in_mem_buf; + hp->str_bv_in_mem_buf_len = ((port_type *)obj)->str_bv_in_mem_buf_len; hp->read_len = ((port_type *)obj)->read_len; return (char *)hp; } diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 6069550a..846c0360 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -789,6 +789,8 @@ typedef struct { char *mem_buf; size_t mem_buf_len; unsigned short read_len; + char *str_bv_in_mem_buf; + char *str_bv_in_mem_buf_len; } port_type; #define CYC_IO_BUF_LEN 1024 diff --git a/runtime.c b/runtime.c index 730041b8..cd25bd04 100644 --- a/runtime.c +++ b/runtime.c @@ -3444,6 +3444,11 @@ object Cyc_io_close_port(void *data, object port) ((port_type *)port)->mem_buf = NULL; ((port_type *)port)->mem_buf_len = 0; } + if (((port_type *)port)->str_bv_in_mem_buf != NULL){ + free( ((port_type *)port)->str_bv_in_mem_buf ); + ((port_type *)port)->str_bv_in_mem_buf = NULL; + ((port_type *)port)->str_bv_in_mem_buf_len = 0; + } if (((port_type *)port)->tok_buf != NULL){ free( ((port_type *)port)->tok_buf ); ((port_type *)port)->tok_buf = NULL;