[vlc-commits] picture_pool: fix refcount leak if pic_lock fails.

Thomas Guillem git at videolan.org
Sat Nov 1 10:31:47 CET 2014


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Oct 31 17:30:39 2014 +0100| [d15a47776eca80d258baacac2d0709c77679d7da] | committer: Rémi Denis-Courmont

picture_pool: fix refcount leak if pic_lock fails.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d15a47776eca80d258baacac2d0709c77679d7da
---

 src/misc/picture_pool.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
index 2a0f677..5d54301 100644
--- a/src/misc/picture_pool.c
+++ b/src/misc/picture_pool.c
@@ -277,8 +277,10 @@ picture_t *picture_pool_Get(picture_pool_t *pool)
         if (!atomic_compare_exchange_strong(&picture->gc.refcount, &refs, 1))
             continue;
 
-        if (pool->pic_lock != NULL && pool->pic_lock(picture) != 0)
+        if (pool->pic_lock != NULL && pool->pic_lock(picture) != 0) {
+            atomic_store(&picture->gc.refcount, 0);
             continue;
+        }
 
         /* */
         picture->p_next = NULL;



More information about the vlc-commits mailing list