TAPE: Fix potential NULL references (COVERITY)
This commit is contained in:
parent
009e5061e2
commit
872b2f238d
1 changed files with 7 additions and 4 deletions
11
sim_tape.c
11
sim_tape.c
|
@ -526,12 +526,15 @@ return SCPE_OK;
|
||||||
|
|
||||||
t_stat sim_tape_detach (UNIT *uptr)
|
t_stat sim_tape_detach (UNIT *uptr)
|
||||||
{
|
{
|
||||||
struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
|
struct tape_context *ctx;
|
||||||
uint32 f = MT_GET_FMT (uptr);
|
uint32 f = MT_GET_FMT (uptr);
|
||||||
t_stat r;
|
t_stat r;
|
||||||
t_bool auto_format = FALSE;
|
t_bool auto_format = FALSE;
|
||||||
|
|
||||||
if ((ctx == NULL) || (uptr == NULL) || !(uptr->flags & UNIT_ATT))
|
if (uptr == NULL)
|
||||||
|
return SCPE_IERR;
|
||||||
|
ctx = (struct tape_context *)uptr->tape_ctx;
|
||||||
|
if ((ctx == NULL) || !(uptr->flags & UNIT_ATT))
|
||||||
return SCPE_IERR;
|
return SCPE_IERR;
|
||||||
|
|
||||||
if (uptr->io_flush)
|
if (uptr->io_flush)
|
||||||
|
@ -2160,10 +2163,10 @@ t_stat sim_tape_set_fmt (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
|
||||||
{
|
{
|
||||||
uint32 f;
|
uint32 f;
|
||||||
|
|
||||||
if (uptr->flags & UNIT_ATT)
|
|
||||||
return SCPE_ALATT;
|
|
||||||
if (uptr == NULL)
|
if (uptr == NULL)
|
||||||
return SCPE_IERR;
|
return SCPE_IERR;
|
||||||
|
if (uptr->flags & UNIT_ATT)
|
||||||
|
return SCPE_ALATT;
|
||||||
if (cptr == NULL)
|
if (cptr == NULL)
|
||||||
return SCPE_ARG;
|
return SCPE_ARG;
|
||||||
for (f = 0; f < MTUF_N_FMT; f++) {
|
for (f = 0; f < MTUF_N_FMT; f++) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue