From 32bd6c41bc875e67808fa1adcf4d1114cb593f58 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 23 Sep 2021 22:35:52 -0700 Subject: [PATCH] Fix regression with `VVV_COMPILEMUSIC` aborting So, it turns out freeing everything in binaryBlob::clear() without checking for NULL results in an abort() because clear() gets called on musicWriteBlob after it attempts to write the compiled music. It's just that no one's using VVV_COMPILEMUSIC, so no one's ran into this. I'm keeping VVV_COMPILEMUSIC around so in the future people can compile music directly from the game (and probably half the existing VVV_COMPILEMUSIC code is going to be thrown out, but oh well). --- desktop_version/src/BinaryBlob.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/BinaryBlob.cpp b/desktop_version/src/BinaryBlob.cpp index 1ed7d93e..78a68814 100644 --- a/desktop_version/src/BinaryBlob.cpp +++ b/desktop_version/src/BinaryBlob.cpp @@ -89,7 +89,10 @@ void binaryBlob::clear(void) { for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1) { - SDL_free(m_memblocks[i]); + if (m_memblocks[i] != NULL) + { + SDL_free(m_memblocks[i]); + } } SDL_zeroa(m_memblocks); SDL_zeroa(m_headers);