1
0
mirror of https://github.com/simh/simh.git synced 2026-05-02 22:22:48 +00:00

SCP: Fix memory leak in error paths of RESTORE command (COVERITY)

This commit is contained in:
Mark Pizzolato
2017-03-13 17:25:42 -07:00
parent a943737ab4
commit de95d5bec1

12
scp.c
View File

@@ -6141,10 +6141,14 @@ t_bool suppress_warning = ((sim_switches & SWMASK ('Q')) != 0);
t_bool warned = FALSE; t_bool warned = FALSE;
sim_switches &= ~(SWMASK ('F') | SWMASK ('D') | SWMASK ('Q')); /* remove digested switches */ sim_switches &= ~(SWMASK ('F') | SWMASK ('D') | SWMASK ('Q')); /* remove digested switches */
#define READ_S(xx) if (read_line ((xx), sizeof(xx), rfile) == NULL) \ #define READ_S(xx) if (read_line ((xx), sizeof(xx), rfile) == NULL) { \
return SCPE_IOERR; r = SCPE_IOERR; \
#define READ_I(xx) if (sim_fread (&xx, sizeof (xx), 1, rfile) == 0) \ goto Cleanup_Return; \
return SCPE_IOERR; }
#define READ_I(xx) if (sim_fread (&xx, sizeof (xx), 1, rfile) == 0) { \
r = SCPE_IOERR; \
goto Cleanup_Return; \
}
fstat (fileno (rfile), &rstat); fstat (fileno (rfile), &rstat);
READ_S (buf); /* [V2.5+] read version */ READ_S (buf); /* [V2.5+] read version */