[MPlayer-cvslog] r37751 - trunk/libmpdemux/aviheader.c

reimar subversion at mplayerhq.hu
Sat Feb 20 12:02:44 CET 2016


Author: reimar
Date: Sat Feb 20 12:02:44 2016
New Revision: 37751

Log:
Use calloc over malloc.

Avoids having to check multiplication for overflow.
Fixes Coverity warning.

Modified:
   trunk/libmpdemux/aviheader.c

Modified: trunk/libmpdemux/aviheader.c
==============================================================================
--- trunk/libmpdemux/aviheader.c	Sat Feb 20 12:02:42 2016	(r37750)
+++ trunk/libmpdemux/aviheader.c	Sat Feb 20 12:02:44 2016	(r37751)
@@ -614,7 +614,7 @@ if (index_file_load) {
     goto gen_index;
   }
   fread(&priv->idx_size, sizeof(priv->idx_size), 1, fp);
-  priv->idx=malloc(priv->idx_size*sizeof(AVIINDEXENTRY));
+  priv->idx=calloc(priv->idx_size,sizeof(AVIINDEXENTRY));
   if (!priv->idx) {
     mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_FailedMallocForIdxFile, index_file_load);
     priv->idx_size = 0;


More information about the MPlayer-cvslog mailing list