From: Toni Wilen Date: Sat, 30 Apr 2016 13:56:07 +0000 (+0300) Subject: Free SCSI struct only after device use count becomes zero. X-Git-Tag: 3300~41 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=cfb0d25a60133c726b26fb1fc91a628294f92330;p=francis%2Fwinuae.git Free SCSI struct only after device use count becomes zero. --- 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);