[vlc-commits] vdpau: fix leak on picture pool error

Rémi Denis-Courmont git at videolan.org
Sun Jul 14 22:39:22 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 14 23:08:47 2013 +0300| [40e38ac09311ad5cba0d7da3e983957ef8ed7455] | committer: Rémi Denis-Courmont

vdpau: fix leak on picture pool error

(same problem as XCB)

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

 modules/hw/vdpau/display.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index e177102..1607e43 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -136,7 +136,15 @@ static picture_pool_t *PoolAlloc(vout_display_t *vd, unsigned requested_count)
         count++;
     }
     sys->current = NULL;
-    return count ? picture_pool_New(count, pics) : NULL;
+
+    if (count == 0)
+        return NULL;
+
+    picture_pool_t *pool = picture_pool_New(count, pics);
+    if (unlikely(pool == NULL))
+        while (count > 0)
+            picture_Release(pics[--count]);
+    return pool;
 }
 
 static void PoolFree(vout_display_t *vd, picture_pool_t *pool)



More information about the vlc-commits mailing list