mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-02 15:32:49 +02:00
Merge pull request #570 from max-m/fix-cheats
Fix memory corruption on removal / update of cheats with the same address hash
This commit is contained in:
@@ -132,7 +132,7 @@ void GB_remove_cheat(GB_gameboy_t *gb, const GB_cheat_t *cheat)
|
|||||||
*hash = NULL;
|
*hash = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*hash = malloc(sizeof(GB_cheat_hash_t) + sizeof(cheat) * (*hash)->size);
|
*hash = realloc(*hash, sizeof(GB_cheat_hash_t) + sizeof(cheat) * (*hash)->size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -228,7 +228,7 @@ void GB_update_cheat(GB_gameboy_t *gb, const GB_cheat_t *_cheat, const char *des
|
|||||||
*hash = NULL;
|
*hash = NULL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*hash = malloc(sizeof(GB_cheat_hash_t) + sizeof(cheat) * (*hash)->size);
|
*hash = realloc(*hash, sizeof(GB_cheat_hash_t) + sizeof(cheat) * (*hash)->size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user