[MPlayer-cvslog] CVS: main/libmpdemux aviheader.c,1.75,1.76
Reimar Döffinger CVS
syncmail at mplayerhq.hu
Thu Apr 6 22:56:37 CEST 2006
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv23970
Modified Files:
aviheader.c
Log Message:
use calloc instead of malloc - simplifies code and fixes overflow problems.
Path by Bjorn Sandell (biorn at chalmers se)
Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/aviheader.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- aviheader.c 6 Apr 2006 20:36:39 -0000 1.75
+++ aviheader.c 6 Apr 2006 20:56:35 -0000 1.76
@@ -206,7 +206,6 @@
break; }
case mmioFOURCC('i', 'n', 'd', 'x'): {
uint32_t i;
- unsigned msize = 0;
avisuperindex_chunk *s;
priv->suidx_size++;
priv->suidx = realloc(priv->suidx, priv->suidx_size * sizeof (avisuperindex_chunk));
@@ -235,11 +234,8 @@
mp_msg (MSGT_HEADER, MSGL_WARN, "Broken super index chunk size: %u\n",s->wLongsPerEntry);
s->wLongsPerEntry = sizeof(avisuperindex_entry)/4;
}
- msize = sizeof (avisuperindex_entry) * s->nEntriesInUse;
- s->aIndex = malloc(msize);
- memset (s->aIndex, 0, msize);
- s->stdidx = malloc (s->nEntriesInUse * sizeof (avistdindex_chunk));
- memset (s->stdidx, 0, s->nEntriesInUse * sizeof (avistdindex_chunk));
+ s->aIndex = calloc(s->nEntriesInUse, sizeof (avisuperindex_entry));
+ s->stdidx = calloc(s->nEntriesInUse, sizeof (avistdindex_chunk));
// now the real index of indices
for (i=0; i<s->nEntriesInUse; i++) {
More information about the MPlayer-cvslog
mailing list