diff --git a/src/gba/cheats.c b/src/gba/cheats.c index 0bbd2b06b..a9702bd4e 100644 --- a/src/gba/cheats.c +++ b/src/gba/cheats.c @@ -110,13 +110,18 @@ void GBACheatDeviceCreate(struct GBACheatDevice* device) { } void GBACheatDeviceDestroy(struct GBACheatDevice* device) { + GBACheatDeviceClear(device); + GBACheatSetsDeinit(&device->cheats); +} + +void GBACheatDeviceClear(struct GBACheatDevice* device) { size_t i; for (i = 0; i < GBACheatSetsSize(&device->cheats); ++i) { struct GBACheatSet* set = *GBACheatSetsGetPointer(&device->cheats, i); GBACheatSetDeinit(set); free(set); } - GBACheatSetsDeinit(&device->cheats); + GBACheatSetsClear(&device->cheats); } void GBACheatSetInit(struct GBACheatSet* set, const char* name) { diff --git a/src/gba/cheats.h b/src/gba/cheats.h index 73b08940a..2bf992ff2 100644 --- a/src/gba/cheats.h +++ b/src/gba/cheats.h @@ -192,6 +192,7 @@ struct VFile; void GBACheatDeviceCreate(struct GBACheatDevice*); void GBACheatDeviceDestroy(struct GBACheatDevice*); +void GBACheatDeviceClear(struct GBACheatDevice*); void GBACheatSetInit(struct GBACheatSet*, const char* name); void GBACheatSetDeinit(struct GBACheatSet*);