From 816cb5af448df344b65aa32bfdf4d4c3766b2082 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Tue, 27 Sep 2016 10:20:03 -0700 Subject: [PATCH] GBA Cheats: Fix uninitialized memory getting freed when saving --- CHANGES | 1 + src/gba/cheats.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index dac85dce9..53791225c 100644 --- a/CHANGES +++ b/CHANGES @@ -22,6 +22,7 @@ Bugfixes: - GB: Initialize audio properly - GB MBC: Fix RTC access when no save file is loaded - GB: Properly clear KEY1 bit 0 when switching speeds + - GBA Cheats: Fix uninitialized memory getting freed when saving Misc: - All: Only update version info if needed - FFmpeg: Encoding cleanup diff --git a/src/gba/cheats.c b/src/gba/cheats.c index 747caab48..5467819cd 100644 --- a/src/gba/cheats.c +++ b/src/gba/cheats.c @@ -300,14 +300,16 @@ static void GBACheatDumpDirectives(struct mCheatSet* set, struct StringList* dir } StringListClear(directives); - char** directive = StringListAppend(directives); + char** directive; switch (cheats->gsaVersion) { case 1: case 2: + directive = StringListAppend(directives); *directive = strdup("GSAv1"); break; case 3: case 4: + directive = StringListAppend(directives); *directive = strdup("PARv3"); break; }