changeset 18366:d18fc000093d

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.
author rfelker
date Mon, 01 May 2006 02:04:09 +0000
parents bdec1b4d8623
children d65d54205d19
files libmpdemux/muxer.c libmpdemux/stream_dvd.c libmpdemux/tv.c libmpdemux/yuv4mpeg.c
diffstat 4 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/muxer.c	Sun Apr 30 22:28:15 2006 +0000
+++ b/libmpdemux/muxer.c	Mon May 01 02:04:09 2006 +0000
@@ -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;
--- a/libmpdemux/stream_dvd.c	Sun Apr 30 22:28:15 2006 +0000
+++ b/libmpdemux/stream_dvd.c	Mon May 01 02:04:09 2006 +0000
@@ -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);
--- a/libmpdemux/tv.c	Sun Apr 30 22:28:15 2006 +0000
+++ b/libmpdemux/tv.c	Mon May 01 02:04:09 2006 +0000
@@ -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;
--- a/libmpdemux/yuv4mpeg.c	Sun Apr 30 22:28:15 2006 +0000
+++ b/libmpdemux/yuv4mpeg.c	Mon May 01 02:04:09 2006 +0000
@@ -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);
 }