1
mirror of https://github.com/mpv-player/mpv synced 2024-09-05 02:48:21 +02:00

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.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18367 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
rfelker 2006-05-01 02:04:09 +00:00
parent 40b6f59ac4
commit 5878ff9f5a
4 changed files with 4 additions and 4 deletions

View File

@ -82,7 +82,7 @@ void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double
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;

View File

@ -518,7 +518,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
/* 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);

View File

@ -375,7 +375,7 @@ static int open_tv(tvi_handle_t *tvh)
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;

View File

@ -103,7 +103,7 @@ ssize_t y4m_write(int fd, char *buf, size_t len)
static char *y4m_new_xtag(void)
{
return _y4m_alloc(Y4M_MAX_XTAG_SIZE * sizeof(char));
return _y4m_alloc(Y4M_MAX_XTAG_SIZE);
}