#include <vlc_common.h>
#include <vlc_access.h>
+#include <limits.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
if( pp_sectors )
{
- *pp_sectors = malloc( (i_tracks + 1) * sizeof(**pp_sectors) );
+ *pp_sectors = calloc( i_tracks + 1, sizeof(**pp_sectors) );
if( *pp_sectors == NULL )
return 0;
memcpy( *pp_sectors, p_vcddev->p_sectors,
CDTOCDescriptor *pTrackDescriptors;
u_char track;
- *pp_sectors = malloc( (i_tracks + 1) * sizeof(**pp_sectors) );
+ *pp_sectors = calloc( i_tracks + 1, sizeof(**pp_sectors) );
if( *pp_sectors == NULL )
{
darwin_freeTOC( pTOC );
((unsigned int)p_tocheader[1] << 8);
p_fulltoc = malloc( i_toclength );
- *pp_sectors = malloc( (i_tracks + 1) * sizeof(**pp_sectors) );
+ *pp_sectors = calloc( i_tracks + 1, sizeof(**pp_sectors) );
if( *pp_sectors == NULL || p_fulltoc == NULL )
{
{
int i;
- *pp_sectors = malloc( (i_tracks + 1) * sizeof(**pp_sectors) );
+ *pp_sectors = calloc( i_tracks + 1, sizeof(**pp_sectors) );
if( *pp_sectors == NULL )
return 0;
{
int i;
- *pp_sectors = malloc( (i_tracks + 1) * sizeof(**pp_sectors) );
+ *pp_sectors = calloc( i_tracks + 1, sizeof(**pp_sectors) );
if( *pp_sectors == NULL )
return 0;
{
int i;
- *pp_sectors = malloc( (i_tracks + 1) * sizeof(**pp_sectors) );
+ *pp_sectors = calloc( i_tracks + 1, sizeof(**pp_sectors) );
if( *pp_sectors == NULL )
return 0;
* about the cuefile */
size_t i_tracks = 0;
- while( fgets( line, 1024, cuefile ) )
+ while( fgets( line, 1024, cuefile ) && i_tracks < INT_MAX-1 )
{
/* look for a TRACK line */
char psz_dummy[9];
&i_min, &i_sec, &i_frame ) != 4) || (i_num != 1) )
continue;
- int *buf = realloc (p_sectors, (i_tracks + 1) * sizeof (int));
+ int *buf = realloc (p_sectors, (i_tracks + 1) * sizeof (*buf));
if (buf == NULL)
goto error;
p_sectors = buf;
}
/* fill in the last entry */
- int *buf = realloc (p_sectors, (i_tracks + 1) * sizeof (int));
+ int *buf = realloc (p_sectors, (i_tracks + 1) * sizeof (*buf));
if (buf == NULL)
goto error;
p_sectors = buf;