truemotion1: fix leaking frame on init failure
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Mon, 5 Dec 2016 20:41:06 +0000 (21:41 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Mon, 5 Dec 2016 22:04:35 +0000 (23:04 +0100)
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavcodec/truemotion1.c

index da843c4..c2022fb 100644 (file)
@@ -489,8 +489,10 @@ static av_cold int truemotion1_decode_init(AVCodecContext *avctx)
     /* there is a vertical predictor for each pixel in a line; each vertical
      * predictor is 0 to start with */
     av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * sizeof(unsigned int));
-    if (!s->vert_pred)
+    if (!s->vert_pred) {
+        av_frame_free(&s->frame);
         return AVERROR(ENOMEM);
+    }
 
     return 0;
 }