rv34: Fix a memory leak on errors
authorMartin Storsjö <martin@martin.st>
Mon, 16 Sep 2013 13:05:18 +0000 (16:05 +0300)
committerMartin Storsjö <martin@martin.st>
Thu, 19 Sep 2013 08:09:18 +0000 (11:09 +0300)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/rv34.c

index af37855..7eb97e7 100644 (file)
@@ -1495,8 +1495,10 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
         ff_rv40dsp_init(&r->rdsp);
 #endif
 
-    if ((ret = rv34_decoder_alloc(r)) < 0)
+    if ((ret = rv34_decoder_alloc(r)) < 0) {
+        ff_MPV_common_end(&r->s);
         return ret;
+    }
 
     if(!intra_vlcs[0].cbppattern[0].bits)
         rv34_init_tables();
@@ -1517,8 +1519,10 @@ int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx)
         r->tmp_b_block_base = NULL;
         if ((err = ff_MPV_common_init(&r->s)) < 0)
             return err;
-        if ((err = rv34_decoder_alloc(r)) < 0)
+        if ((err = rv34_decoder_alloc(r)) < 0) {
+            ff_MPV_common_end(&r->s);
             return err;
+        }
     }
 
     return 0;