mirror of https://github.com/mgba-emu/mgba.git
Core: Improve memory handling when deleting a cheat device
This commit is contained in:
parent
0cf138775b
commit
57c8ac1dd9
|
@ -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) {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue