[MPlayer-cvslog] r37761 - trunk/libmpdemux/demux_mkv.c

reimar subversion at mplayerhq.hu
Sat Feb 20 13:00:16 CET 2016


Author: reimar
Date: Sat Feb 20 13:00:16 2016
New Revision: 37761

Log:
demux_mkv: Use calloc.

Avoids unchecked multiplications.

Modified:
   trunk/libmpdemux/demux_mkv.c

Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c	Sat Feb 20 12:37:20 2016	(r37760)
+++ trunk/libmpdemux/demux_mkv.c	Sat Feb 20 13:00:16 2016	(r37761)
@@ -1899,33 +1899,33 @@ static int demux_mkv_open_audio(demuxer_
             sh_a->wf->nAvgBytesPerSec = atrc_fl2bps[flavor];
             sh_a->wf->nBlockAlign = track->sub_packet_size;
             track->audio_buf =
-                malloc(track->sub_packet_h * track->audiopk_size);
+                calloc(track->sub_packet_h, track->audiopk_size);
             track->audio_timestamp =
-                malloc(track->sub_packet_h * sizeof(float));
+                calloc(track->sub_packet_h, sizeof(float));
             break;
         case mmioFOURCC('c', 'o', 'o', 'k'):
             sh_a->wf->nAvgBytesPerSec = cook_fl2bps[flavor];
             sh_a->wf->nBlockAlign = track->sub_packet_size;
             track->audio_buf =
-                malloc(track->sub_packet_h * track->audiopk_size);
+                calloc(track->sub_packet_h, track->audiopk_size);
             track->audio_timestamp =
-                malloc(track->sub_packet_h * sizeof(float));
+                calloc(track->sub_packet_h, sizeof(float));
             break;
         case mmioFOURCC('s', 'i', 'p', 'r'):
             sh_a->wf->nAvgBytesPerSec = sipr_fl2bps[flavor];
             sh_a->wf->nBlockAlign = track->coded_framesize;
             track->audio_buf =
-                malloc(track->sub_packet_h * track->audiopk_size);
+                calloc(track->sub_packet_h, track->audiopk_size);
             track->audio_timestamp =
-                malloc(track->sub_packet_h * sizeof(float));
+                calloc(track->sub_packet_h, sizeof(float));
             break;
         case mmioFOURCC('2', '8', '_', '8'):
             sh_a->wf->nAvgBytesPerSec = 3600;
             sh_a->wf->nBlockAlign = track->coded_framesize;
             track->audio_buf =
-                malloc(track->sub_packet_h * track->audiopk_size);
+                calloc(track->sub_packet_h, track->audiopk_size);
             track->audio_timestamp =
-                malloc(track->sub_packet_h * sizeof(float));
+                calloc(track->sub_packet_h, sizeof(float));
             break;
         }
 


More information about the MPlayer-cvslog mailing list