From 19265b8d0da2f999ddece4790f632e66bb8bf7cc Mon Sep 17 00:00:00 2001 From: Richard Knight Date: Fri, 30 Dec 2022 21:41:30 +0000 Subject: fix segfault --- src/opcodes.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/opcodes.cpp b/src/opcodes.cpp index 460aee0..2d7d8b8 100644 --- a/src/opcodes.cpp +++ b/src/opcodes.cpp @@ -161,8 +161,8 @@ private: } complete: if (lbuffer != NULL) { - csound->free(lbuffer); // causes segfault, WHY??????????? - lbuffer = NULL; + //csound->free(lbuffer); // causes segfault, WHY??????????? + //lbuffer = NULL; } pmparser_free(csound, maps); } @@ -187,7 +187,9 @@ public: } ~MemParser() { - close(fd_mem); + if (fd_mem) { + close(fd_mem); + } if (buffer != NULL) { csound->free(buffer); } @@ -224,7 +226,6 @@ public: iterate_memory_step( [&](long index, MYFLT val) { if (index < offset_position) return true; - //std::cout << index << "-" << offset_position << "\n"; buffer[buffer_write_position] = val; if (buffer_write_position < buffer_size) { buffer_write_position ++; -- cgit v1.2.3