diff h263dec.c @ 9415:141badec76fc libavcodec

Add a av_fast_malloc function and replace several uses of av_fast_realloc, thus avoiding potential memleaks and pointless memcpys.
author reimar
date Sun, 12 Apr 2009 13:17:37 +0000
parents 54bc8a2727b0
children bd3e11b60ccd
line wrap: on
line diff
--- a/h263dec.c	Sun Apr 12 12:25:53 2009 +0000
+++ b/h263dec.c	Sun Apr 12 13:17:37 2009 +0000
@@ -687,10 +687,12 @@
         }
 
         if(startcode_found){
-            s->bitstream_buffer= av_fast_realloc(
-                s->bitstream_buffer,
+            av_fast_malloc(
+                &s->bitstream_buffer,
                 &s->allocated_bitstream_buffer_size,
                 buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE);
+            if (!s->bitstream_buffer)
+                return AVERROR(ENOMEM);
             memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos);
             s->bitstream_buffer_size= buf_size - current_pos;
         }