diff mbox

[FFmpeg-devel] truemotion1: fix leaking frame on init failure

Message ID 2479dc14-822e-867e-017f-969c87de5914@googlemail.com
State Accepted
Commit 46e75617d9700be8840a843237f8571061a63a8e
Headers show

Commit Message

Andreas Cadhalpun Dec. 5, 2016, 8:51 p.m. UTC
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
 libavcodec/truemotion1.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Dec. 5, 2016, 9:33 p.m. UTC | #1
On Mon, Dec 05, 2016 at 09:51:31PM +0100, Andreas Cadhalpun wrote:
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
> ---
>  libavcodec/truemotion1.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

LGTM

thx

[...]
Andreas Cadhalpun Dec. 5, 2016, 10:06 p.m. UTC | #2
On 05.12.2016 22:33, Michael Niedermayer wrote:
> On Mon, Dec 05, 2016 at 09:51:31PM +0100, Andreas Cadhalpun wrote:
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
>> ---
>>  libavcodec/truemotion1.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> LGTM

Pushed.

Best regards,
Andreas
diff mbox

Patch

diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index da843c4..c2022fb 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -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;
 }