From cfb0d25a60133c726b26fb1fc91a628294f92330 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 30 Apr 2016 16:56:07 +0300 Subject: [PATCH] Free SCSI struct only after device use count becomes zero. --- hardfile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardfile.cpp b/hardfile.cpp index cd812d8a..bb19121b 100644 --- a/hardfile.cpp +++ b/hardfile.cpp @@ -2112,10 +2112,10 @@ static uae_u32 REGPARAM2 hardfile_close (TrapContext *ctx) if (!hfpd) return 0; - scsi_free(hfpd->sd); - hfpd->sd = NULL; trap_put_word(ctx, hfpd->base + 32, trap_get_word(ctx, hfpd->base + 32) - 1); if (trap_get_word(ctx, hfpd->base + 32) == 0) { + scsi_free(hfpd->sd); + hfpd->sd = NULL; write_comm_pipe_pvoid(&hfpd->requests, NULL, 0); write_comm_pipe_pvoid(&hfpd->requests, NULL, 0); write_comm_pipe_u32(&hfpd->requests, 0, 1); -- 2.47.3