From e353b910eae1819acca8dcbcd627dae141c87c0d Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 11 Dec 2020 07:18:27 -0800 Subject: [PATCH] TMXR: Fix Coverity identified missing status check --- sim_tmxr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sim_tmxr.c b/sim_tmxr.c index 329e5023..d3a64bb9 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -5079,6 +5079,7 @@ t_stat tmxr_set_log (UNIT *uptr, int32 val, CONST char *cptr, void *desc) { TMXR *mp = (TMXR *) desc; TMLN *lp; +t_stat r; if (cptr == NULL) /* no file name? */ return SCPE_2FARG; @@ -5091,8 +5092,8 @@ lp->txlogname = (char *) calloc (CBUFSIZE, sizeof (char)); /* alloc namebuf */ if (lp->txlogname == NULL) /* can't? */ return SCPE_MEM; strlcpy (lp->txlogname, cptr, CBUFSIZE); /* save file name */ -sim_open_logfile (cptr, TRUE, &lp->txlog, &lp->txlogref);/* open log */ -if (lp->txlog == NULL) { /* error? */ +r = sim_open_logfile (cptr, TRUE, &lp->txlog, &lp->txlogref);/* open log */ +if ((r != SCPE_OK) || (lp->txlog == NULL)) { /* error? */ free (lp->txlogname); /* free buffer */ return SCPE_OPENERR; }