diff asv1.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 4cb7c65fc775
children 0dce4fe6e6f3
line wrap: on
line diff
--- a/asv1.c	Sun Apr 12 12:25:53 2009 +0000
+++ b/asv1.c	Sun Apr 12 13:17:37 2009 +0000
@@ -408,7 +408,9 @@
     p->pict_type= FF_I_TYPE;
     p->key_frame= 1;
 
-    a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
+    av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
+    if (!a->bitstream_buffer)
+        return AVERROR(ENOMEM);
 
     if(avctx->codec_id == CODEC_ID_ASV1)
         a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (const uint32_t*)buf, buf_size/4);