[MPlayer-cvslog] r24938 - trunk/libmpdemux/muxer_mpeg.c
nicodvb
subversion at mplayerhq.hu
Fri Nov 2 21:06:28 CET 2007
Author: nicodvb
Date: Fri Nov 2 21:06:28 2007
New Revision: 24938
Log:
prevent unlikely memleak
Modified:
trunk/libmpdemux/muxer_mpeg.c
Modified: trunk/libmpdemux/muxer_mpeg.c
==============================================================================
--- trunk/libmpdemux/muxer_mpeg.c (original)
+++ trunk/libmpdemux/muxer_mpeg.c Fri Nov 2 21:06:28 2007
@@ -2348,17 +2348,20 @@ static void mpegfile_write_chunk(muxer_s
if(s->b_buffer_size - s->b_buffer_len < len)
{
+ void *tmp;
+
if(s->b_buffer_len > SIZE_MAX - len)
{
mp_msg(MSGT_MUXER, MSGL_FATAL, "\nFATAL! couldn't realloc, integer overflow\n");
return;
}
- s->b_buffer = realloc(s->b_buffer, len + s->b_buffer_len);
- if(s->b_buffer == NULL)
+ tmp = realloc(s->b_buffer, len + s->b_buffer_len);
+ if(!tmp)
{
mp_msg(MSGT_MUXER, MSGL_FATAL, "\nFATAL! couldn't realloc %d bytes\n", len + s->b_buffer_len);
return;
}
+ s->b_buffer = tmp;
s->b_buffer_size = len + s->b_buffer_len;
mp_msg(MSGT_MUXER, MSGL_DBG2, "REALLOC(%d) bytes to AUDIO backbuffer\n", s->b_buffer_size);
More information about the MPlayer-cvslog
mailing list