From c881dc975fbd16066fdab91aee69cb0ab67f28df Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 18 Dec 2020 22:58:57 +0100 Subject: [PATCH] Fixed a segmentation fault when hard resetting on some Amstrads. --- src/machine/m_amstrad.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index ec0bff6ec..21d1d8805 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -1715,8 +1715,13 @@ vid_close_200(void *priv) { amsvid_t *vid = (amsvid_t *)priv; - free(vid->cga.vram); - free(vid->mda.vram); + if (vid->cga.vram != vid->mda.vram) { + free(vid->cga.vram); + free(vid->mda.vram); + } else + free(vid->cga.vram); + + vid->cga.vram = vid->mda.vram = NULL; free(vid); }