From 12bd47eb029bc4c82d4a4c6402334c43ef03f835 Mon Sep 17 00:00:00 2001 From: Sergey Svishchev Date: Sat, 11 Mar 2017 16:16:34 -0800 Subject: [PATCH] Intel-Systems: plug file descriptor leaks (Coverity Scan) --- Intel-Systems/common/isbc201.c | 1 + Intel-Systems/common/isbc202.c | 1 + Intel-Systems/common/isbc208.c | 1 + Intel-Systems/common/zx200a.c | 1 + 4 files changed, 4 insertions(+) diff --git a/Intel-Systems/common/isbc201.c b/Intel-Systems/common/isbc201.c index 801d8e75..8559aeea 100644 --- a/Intel-Systems/common/isbc201.c +++ b/Intel-Systems/common/isbc201.c @@ -388,6 +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); return SCPE_MEM; } } diff --git a/Intel-Systems/common/isbc202.c b/Intel-Systems/common/isbc202.c index 76ed8a00..d3e80b34 100644 --- a/Intel-Systems/common/isbc202.c +++ b/Intel-Systems/common/isbc202.c @@ -401,6 +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); return SCPE_MEM; } } diff --git a/Intel-Systems/common/isbc208.c b/Intel-Systems/common/isbc208.c index e2bcc529..e0b9e68c 100644 --- a/Intel-Systems/common/isbc208.c +++ b/Intel-Systems/common/isbc208.c @@ -1073,6 +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); return SCPE_MEM; } } diff --git a/Intel-Systems/common/zx200a.c b/Intel-Systems/common/zx200a.c index 8ccf0f9c..8dd8fc90 100644 --- a/Intel-Systems/common/zx200a.c +++ b/Intel-Systems/common/zx200a.c @@ -405,6 +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); return SCPE_MEM; } }