# HG changeset patch # User rfelker # Date 1146449049 0 # Node ID d18fc000093d3d66cd2f23a09fdc47aa91414dee # Parent bdec1b4d8623d3c7b204ef702973b365806f35b0 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. diff -r bdec1b4d8623 -r d18fc000093d libmpdemux/muxer.c --- 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; diff -r bdec1b4d8623 -r d18fc000093d libmpdemux/stream_dvd.c --- 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); diff -r bdec1b4d8623 -r d18fc000093d libmpdemux/tv.c --- 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; diff -r bdec1b4d8623 -r d18fc000093d libmpdemux/yuv4mpeg.c --- 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); }