diff --git a/common.cpp b/common.cpp index 4e3fe7c7c..13d085129 100644 --- a/common.cpp +++ b/common.cpp @@ -668,8 +668,10 @@ void debug( int level, const wchar_t *msg, ... ) CHECK( msg, ); - sb = format_string(L"%ls: ", program_name); - sb.append(vformat_string(msg, va)); + sb = format_string(L"%ls: ", program_name); + va_start(va, msg); + sb.append(vformat_string(msg, va)); + va_end(va); wcstring sb2; write_screen( sb, sb2 ); diff --git a/io.cpp b/io.cpp index 2c18de961..75d6c2538 100644 --- a/io.cpp +++ b/io.cpp @@ -152,7 +152,7 @@ void io_buffer_destroy( io_data_t *io_buffer ) b_destroy( io_buffer->param2.out_buffer ); free( io_buffer->param2.out_buffer ); - free( io_buffer ); + delete io_buffer; }