patch from Honza Horak using Coverity's static analysis tool.

This commit is contained in:
rocky
2011-05-30 15:19:22 -04:00
parent 9be0980337
commit 940b7cd848
20 changed files with 52 additions and 28 deletions

View File

@@ -1048,7 +1048,7 @@ driver_return_code_t
cdio_set_blocksize ( const CdIo_t *p_cdio, int i_blocksize )
{
if (!p_cdio) return DRIVER_OP_UNINIT;
if (p_cdio->op.set_blocksize) return DRIVER_OP_UNSUPPORTED;
if (!p_cdio->op.set_blocksize) return DRIVER_OP_UNSUPPORTED;
return p_cdio->op.set_blocksize(p_cdio->env, i_blocksize);
}

View File

@@ -198,11 +198,13 @@ check_mounts_linux(const char *mtab)
}
}
}
if ( strcmp(mnt_type, "iso9660") == 0 ) {
if (is_cdrom_linux(mnt_dev, mnt_type) > 0) {
free(mnt_type);
endmntent(mntfp);
return mnt_dev;
if ( mnt_type && mnt_dev ) {
if ( strcmp(mnt_type, "iso9660") == 0 ) {
if (is_cdrom_linux(mnt_dev, mnt_type) > 0) {
free(mnt_type);
endmntent(mntfp);
return mnt_dev;
}
}
}
free(mnt_dev);

View File

@@ -621,18 +621,18 @@ parse_tocfile (_img_private_t *cd, const char *psz_cue_name)
goto format_error;
}
} else if (0 == strcmp ("COPY", psz_keyword)) {
if (NULL != cd)
if (NULL != cd && i >= 0)
cd->tocent[i].flags |= CDIO_TRACK_FLAG_COPY_PERMITTED;
} else if (0 == strcmp ("PRE_EMPHASIS", psz_keyword)) {
if (NULL != cd)
if (NULL != cd && i >= 0)
cd->tocent[i].flags |= CDIO_TRACK_FLAG_PRE_EMPHASIS;
/* TWO_CHANNEL_AUDIO */
} else if (0 == strcmp ("TWO_CHANNEL_AUDIO", psz_keyword)) {
if (NULL != cd)
if (NULL != cd && i >= 0)
cd->tocent[i].flags &= ~CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO;
/* FOUR_CHANNEL_AUDIO */
} else if (0 == strcmp ("FOUR_CHANNEL_AUDIO", psz_keyword)) {
if (NULL != cd)
if (NULL != cd && i >= 0)
cd->tocent[i].flags |= CDIO_TRACK_FLAG_FOUR_CHANNEL_AUDIO;
/* ISRC "CCOOOYYSSSSS" */

View File

@@ -182,6 +182,7 @@ parse_nrg (_img_private_t *p_env, const char *psz_nrg_name,
long unsigned int footer_start;
long unsigned int size;
char *footer_buf = NULL;
if (!p_env) return false;
size = cdio_stream_stat (p_env->gen.data_source);
if (-1 == size) return false;

View File

@@ -413,6 +413,7 @@ mmc_set_blocksize_private ( void *p_env,
memset (&mh, 0, sizeof (mh));
mh.block_desc_length = 0x08;
/* while i_blocksize is uint16_t, this expression is always 0 */
mh.block_length_hi = (i_blocksize >> 16) & 0xff;
mh.block_length_med = (i_blocksize >> 8) & 0xff;
mh.block_length_lo = (i_blocksize >> 0) & 0xff;

View File

@@ -176,7 +176,7 @@ cdio_read_mode1_sector (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
if (p_cdio->op.read_mode1_sector) {
return p_cdio->op.read_mode1_sector(p_cdio->env, p_buf, i_lsn, b_form2);
} else if (p_cdio->op.lseek && p_cdio->op.read) {
char buf[CDIO_CD_FRAMESIZE] = { 0, };
char buf[M2RAW_SECTOR_SIZE] = { 0, };
if (0 > cdio_lseek(p_cdio, CDIO_CD_FRAMESIZE*i_lsn, SEEK_SET))
return -1;
if (0 > cdio_read(p_cdio, buf, CDIO_CD_FRAMESIZE))