[MPlayer-cvslog] r37631 - trunk/stream/stream_dvd.c

reimar subversion at mplayerhq.hu
Mon Feb 8 23:02:01 CET 2016


Author: reimar
Date: Mon Feb  8 23:02:00 2016
New Revision: 37631

Log:
stream_dvd: Prefer calloc over malloc.

Modified:
   trunk/stream/stream_dvd.c

Modified: trunk/stream/stream_dvd.c
==============================================================================
--- trunk/stream/stream_dvd.c	Mon Feb  8 22:47:24 2016	(r37630)
+++ trunk/stream/stream_dvd.c	Mon Feb  8 23:02:00 2016	(r37631)
@@ -885,7 +885,7 @@ static int open_s(stream_t *stream,int m
 
     mp_msg(MSGT_OPEN,MSGL_V, "DVD successfully opened.\n");
     // store data
-    d=malloc(sizeof(dvd_priv_t)); memset(d,0,sizeof(dvd_priv_t));
+    d=calloc(1, sizeof(*d));
     d->dvd=dvd;
     d->title=title;
     d->vmg_file=vmg_file;
@@ -1013,7 +1013,7 @@ static int open_s(stream_t *stream,int m
     mp_msg(MSGT_DVD,MSGL_V, "DVD start cell: %d  pack: 0x%X-0x%X  \n",d->cur_cell,d->cur_pack,d->cell_last_pack);
 
     //assign cell_times_table
-    d->cell_times_table = malloc(sizeof(unsigned int) * d->cur_pgc->nr_of_cells);
+    d->cell_times_table = calloc(d->cur_pgc->nr_of_cells, sizeof(*d->cell_times_table));
     if(d->cell_times_table == NULL)
       return STREAM_UNSUPPORTED;
     for(k=0; k<d->cur_pgc->nr_of_cells; k++)


More information about the MPlayer-cvslog mailing list