1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-16 09:38:29 +02:00

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).
This commit is contained in:
Misa 2021-09-23 22:35:52 -07:00
parent 0c5024f7e7
commit 32bd6c41bc

View File

@ -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);