diff options
| author | Paul Schwabauer <github@schwabauer.co> | 2026-01-10 13:53:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-10 12:53:37 +0000 |
| commit | 5bbc32c2d1443390dc4415d62f89fab234f42a81 (patch) | |
| tree | b3e48df7f401d9a803c6a7dc12138fe2c1a53b5b /soh/src/code | |
| parent | c2152a8713223ef94235bcb2e303dc9d9f1c020e (diff) | |
Fix memory leaks in MessageViewer and audio_load (#6124)
Add destructor to MessageViewer to free allocated buffers
Free individual strings from ResourceMgr_ListFiles before freeing the array in audio_load.c
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/audio_load.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c index f5d24756d..71197c133 100644 --- a/soh/src/code/audio_load.c +++ b/soh/src/code/audio_load.c @@ -1352,6 +1352,9 @@ void AudioLoad_Init(void* heap, size_t heapSize) { seqCachePolicyMap[sDat.seqNumber] = sDat.cachePolicy; } + for (int i = 0; i < seqListSize; i++) { + free(seqList[i]); + } free(seqList); // 2S2H [Streamed Audio] We need to load the custom songs after the fonts because streamed songs will use a hash to @@ -1369,6 +1372,9 @@ void AudioLoad_Init(void* heap, size_t heapSize) { fontMap[sf->fntIndex] = strdup(fntList[i]); } + for (int i = 0; i < fntListSize; i++) { + free(fntList[i]); + } free(fntList); int customFontStart = fntListSize; @@ -1377,6 +1383,9 @@ void AudioLoad_Init(void* heap, size_t heapSize) { sf->fntIndex = i; fontMap[i] = strdup(customFntList[i - customFontStart]); } + for (int i = 0; i < customFntListSize; i++) { + free(customFntList[i]); + } free(customFntList); // 2S2H Port I think we need to take use seqListSize because entry 0x7A is missing. @@ -1432,6 +1441,9 @@ void AudioLoad_Init(void* heap, size_t heapSize) { seqNum++; } + for (int i = 0; i < customSeqListSize; i++) { + free(customSeqList[i]); + } free(customSeqList); numFonts = fntListSize; |
