From 2ee01fbded0a6b35b55d125dfd5807219837cf30 Mon Sep 17 00:00:00 2001
From: "Ronald S. Bultje" <rsbultje@gmail.com>
Date: Sat, 24 Mar 2012 20:19:19 +0100
Subject: [PATCH] pthread: free progress if buffer allocation failed.

Else we run out of progress variables after a few failed buffer
allocations.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
---
 libavcodec/pthread.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index bbbc4829ec7..2a11195e780 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -951,6 +951,10 @@ int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f)
             ff_thread_finish_setup(avctx);
     }
 
+    if (err) {
+        free_progress(f);
+        f->thread_opaque = NULL;
+    }
     pthread_mutex_unlock(&p->parent->buffer_mutex);
 
     return err;
-- 
GitLab