From 2363300e64ce2ccd2b8d866c3bbd9ffce3375c8c Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 15 May 2018 07:32:24 -0700 Subject: [PATCH] DISK: Fix Coverity identified error path problems --- sim_disk.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sim_disk.c b/sim_disk.c index 3874cbce..e5f88ace 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1564,11 +1564,8 @@ switch (DK_GET_FMT (uptr)) { /* case on format */ } uptr->filename = (char *) calloc (CBUFSIZE, sizeof (char));/* alloc name buf */ uptr->disk_ctx = ctx = (struct disk_context *)calloc(1, sizeof(struct disk_context)); -if ((uptr->filename == NULL) || (uptr->disk_ctx == NULL)) { - free (uptr->filename); - free (uptr->disk_ctx); +if ((uptr->filename == NULL) || (uptr->disk_ctx == NULL)) return _err_return (uptr, SCPE_MEM); - } strncpy (uptr->filename, cptr, CBUFSIZE); /* save name */ ctx->sector_size = (uint32)sector_size; /* save sector_size */ ctx->capac_factor = ((dptr->dwidth / dptr->aincr) == 16) ? 2 : 1; /* save capacity units (word: 2, byte: 1) */