1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01: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

@ -88,9 +88,12 @@ bool binaryBlob::unPackBinary(const char* name)
void binaryBlob::clear(void)
{
for (size_t i = 0; i < SDL_arraysize(m_headers); i += 1)
{
if (m_memblocks[i] != NULL)
{
SDL_free(m_memblocks[i]);
}
}
SDL_zeroa(m_memblocks);
SDL_zeroa(m_headers);
}