fix crash

This commit is contained in:
CrazyRedMachine 2024-04-22 00:20:41 +02:00
parent 2543d2632f
commit 4f22fd29be

View File

@ -322,7 +322,7 @@ void hook_categ_build_songlist()
__asm("push ecx\n");
__asm("push edx\n");
__asm("sub esp, 0x08\n");
songlist = (uint32_t*)realloc((void*)songlist, sizeof(uint32_t)*(songlist_count+1)); //TODO: only realloc when growing
songlist = (uint32_t*)realloc((void*)songlist, sizeof(uint32_t)*(songlist_count+4)); //TODO: only realloc when growing
songlist_addr = (uint32_t)songlist;
__asm("add esp, 0x08\n");
__asm("pop edx\n");
@ -592,6 +592,9 @@ bool patch_custom_categs(const char *dllFilename, uint8_t mode, uint16_t min, ui
{
g_min_id = min;
g_max_id = max;
#if SIMPLE_CATEG_ALLOC == 1
songlist = (uint32_t*)calloc(1,5);
#endif
if (mode == 2)
{
g_subcategmode = true;