Core: Improve memory handling when deleting a cheat device

This commit is contained in:
Vicki Pfau 2020-12-18 02:54:59 -08:00
parent 0cf138775b
commit 57c8ac1dd9
3 changed files with 1 additions and 2 deletions

View File

@ -60,6 +60,7 @@ void mCheatDeviceCreate(struct mCheatDevice* device) {
void mCheatDeviceDestroy(struct mCheatDevice* device) { void mCheatDeviceDestroy(struct mCheatDevice* device) {
mCheatDeviceClear(device); mCheatDeviceClear(device);
mCheatSetsDeinit(&device->cheats); mCheatSetsDeinit(&device->cheats);
free(device);
} }
void mCheatDeviceClear(struct mCheatDevice* device) { void mCheatDeviceClear(struct mCheatDevice* device) {

View File

@ -143,7 +143,6 @@ static void _GBCoreDeinit(struct mCore* core) {
if (gbcore->cheatDevice) { if (gbcore->cheatDevice) {
mCheatDeviceDestroy(gbcore->cheatDevice); mCheatDeviceDestroy(gbcore->cheatDevice);
} }
free(gbcore->cheatDevice);
mCoreConfigFreeOpts(&core->opts); mCoreConfigFreeOpts(&core->opts);
free(core); free(core);
} }

View File

@ -234,7 +234,6 @@ static void _GBACoreDeinit(struct mCore* core) {
if (gbacore->cheatDevice) { if (gbacore->cheatDevice) {
mCheatDeviceDestroy(gbacore->cheatDevice); mCheatDeviceDestroy(gbacore->cheatDevice);
} }
free(gbacore->cheatDevice);
free(gbacore->audioMixer); free(gbacore->audioMixer);
mCoreConfigFreeOpts(&core->opts); mCoreConfigFreeOpts(&core->opts);
free(core); free(core);