DISK: Fix Coverity identified error path problems
This commit is contained in:
parent
13b4f6563f
commit
2363300e64
1 changed files with 1 additions and 4 deletions
|
@ -1564,11 +1564,8 @@ switch (DK_GET_FMT (uptr)) { /* case on format */
|
||||||
}
|
}
|
||||||
uptr->filename = (char *) calloc (CBUFSIZE, sizeof (char));/* alloc name buf */
|
uptr->filename = (char *) calloc (CBUFSIZE, sizeof (char));/* alloc name buf */
|
||||||
uptr->disk_ctx = ctx = (struct disk_context *)calloc(1, sizeof(struct disk_context));
|
uptr->disk_ctx = ctx = (struct disk_context *)calloc(1, sizeof(struct disk_context));
|
||||||
if ((uptr->filename == NULL) || (uptr->disk_ctx == NULL)) {
|
if ((uptr->filename == NULL) || (uptr->disk_ctx == NULL))
|
||||||
free (uptr->filename);
|
|
||||||
free (uptr->disk_ctx);
|
|
||||||
return _err_return (uptr, SCPE_MEM);
|
return _err_return (uptr, SCPE_MEM);
|
||||||
}
|
|
||||||
strncpy (uptr->filename, cptr, CBUFSIZE); /* save name */
|
strncpy (uptr->filename, cptr, CBUFSIZE); /* save name */
|
||||||
ctx->sector_size = (uint32)sector_size; /* save sector_size */
|
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) */
|
ctx->capac_factor = ((dptr->dwidth / dptr->aincr) == 16) ? 2 : 1; /* save capacity units (word: 2, byte: 1) */
|
||||||
|
|
Loading…
Add table
Reference in a new issue