[MPlayer-cvslog] CVS: main/libmpdemux muxer.c, 1.16, 1.17 stream_dvd.c, 1.16, 1.17 tv.c, 1.80, 1.81 yuv4mpeg.c, 1.3, 1.4

Richard Felker CVS syncmail at mplayerhq.hu
Mon May 1 04:04:12 CEST 2006


CVS change done by Richard Felker CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv14313

Modified Files:
	muxer.c stream_dvd.c tv.c yuv4mpeg.c 
Log Message:
100000l to the fools who don't know C
These were all found while auditing for malloc(A*B) type bugs.
Removing them makes it easier to find real incorrect usage and makes
the code more readable.


Index: muxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- muxer.c	12 Mar 2006 22:14:00 -0000	1.16
+++ muxer.c	1 May 2006 02:04:09 -0000	1.17
@@ -82,7 +82,7 @@
       buf->pts= pts;
       buf->len = len;
       buf->flags = flags;
-      buf->buffer = malloc(len * sizeof (unsigned char));
+      buf->buffer = malloc(len);
       if (!buf->buffer) {
         mp_msg(MSGT_MUXER, MSGL_FATAL, MSGTR_MuxbufMallocErr);
         return;

Index: stream_dvd.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/stream_dvd.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- stream_dvd.c	24 Apr 2006 07:20:34 -0000	1.16
+++ stream_dvd.c	1 May 2006 02:04:09 -0000	1.17
@@ -518,7 +518,7 @@
     /* Dynamic DVD drive selection on Darwin */
     if(!strcmp(dvd_device, "/dev/rdiskN")) {
       int i;
-      char *temp_device = malloc((strlen(dvd_device)+1)*sizeof(char));
+      char *temp_device = malloc(strlen(dvd_device)+1);
 
       for (i = 1; i < 10; i++) {
         sprintf(temp_device, "/dev/rdisk%d", i);

Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- tv.c	21 Apr 2006 12:45:18 -0000	1.80
+++ tv.c	1 May 2006 02:04:09 -0000	1.81
@@ -375,7 +375,7 @@
   	  tv_channel_current->prev->next = NULL;
 	free(tv_channel_current);
     } else 
-	    tv_channel_last_real = malloc(sizeof(char)*5);
+	    tv_channel_last_real = malloc(5);
 
     if (tv_channel_list) {
 	int i;

Index: yuv4mpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/yuv4mpeg.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- yuv4mpeg.c	9 Feb 2006 14:07:57 -0000	1.3
+++ yuv4mpeg.c	1 May 2006 02:04:09 -0000	1.4
@@ -103,7 +103,7 @@
 
 static char *y4m_new_xtag(void)
 {
-  return _y4m_alloc(Y4M_MAX_XTAG_SIZE * sizeof(char));
+  return _y4m_alloc(Y4M_MAX_XTAG_SIZE);
 }
 
 




More information about the MPlayer-cvslog mailing list