From ba527ab24a1f182616f0987d1f578b727d49a40f Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sat, 11 Mar 2017 22:28:33 -0800 Subject: [PATCH] Intel-Systems: Fix prior - plug file descriptor leaks (Coverity Scan) --- Intel-Systems/common/isbc201.c | 2 +- Intel-Systems/common/isbc202.c | 2 +- Intel-Systems/common/isbc208.c | 2 +- Intel-Systems/common/zx200a.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Intel-Systems/common/isbc201.c b/Intel-Systems/common/isbc201.c index 8559aeea..1a5fb36f 100644 --- a/Intel-Systems/common/isbc201.c +++ b/Intel-Systems/common/isbc201.c @@ -388,7 +388,7 @@ t_stat isbc201_attach (UNIT *uptr, CONST char *cptr) fdc201[fdcnum].fdd[fddnum].buf = (uint8 *)malloc(flen); if (fdc201[fdcnum].fdd[fddnum].buf == NULL) { sim_printf(" isbc201_attach: Malloc error\n"); - free(fp); + fclose(fp); return SCPE_MEM; } } diff --git a/Intel-Systems/common/isbc202.c b/Intel-Systems/common/isbc202.c index d3e80b34..5dfd6d8c 100644 --- a/Intel-Systems/common/isbc202.c +++ b/Intel-Systems/common/isbc202.c @@ -401,7 +401,7 @@ t_stat isbc202_attach (UNIT *uptr, CONST char *cptr) fdc202[fdcnum].fdd[fddnum].buf = (uint8 *)malloc(flen); if (fdc202[fdcnum].fdd[fddnum].buf == NULL) { sim_printf(" isbc202_attach: Malloc error\n"); - free(fp); + fclose(fp); return SCPE_MEM; } } diff --git a/Intel-Systems/common/isbc208.c b/Intel-Systems/common/isbc208.c index e0b9e68c..ce205d62 100644 --- a/Intel-Systems/common/isbc208.c +++ b/Intel-Systems/common/isbc208.c @@ -1073,7 +1073,7 @@ t_stat isbc208_attach (UNIT *uptr, CONST char *cptr) isbc208_buf[uptr->u6] = (uint8 *)malloc(flen); if (isbc208_buf[uptr->u6] == NULL) { sim_printf(" iSBC208_attach: Malloc error\n"); - free(fp); + fclose(fp); return SCPE_MEM; } } diff --git a/Intel-Systems/common/zx200a.c b/Intel-Systems/common/zx200a.c index 8dd8fc90..4b3dd720 100644 --- a/Intel-Systems/common/zx200a.c +++ b/Intel-Systems/common/zx200a.c @@ -405,7 +405,7 @@ t_stat zx200a_attach (UNIT *uptr, CONST char *cptr) zx200a[fdcnum].fdd[fddnum].buf = (uint8 *)malloc(flen); if (zx200a[fdcnum].fdd[fddnum].buf == NULL) { sim_printf(" zx200a_attach: Malloc error\n"); - free(fp); + fclose(fp); return SCPE_MEM; } }