]> git.sesse.net Git - vlc/commitdiff
vdpau: fix leak on picture pool error
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 14 Jul 2013 20:08:47 +0000 (23:08 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 14 Jul 2013 20:08:47 +0000 (23:08 +0300)
(same problem as XCB)

modules/hw/vdpau/display.c

index e177102b72f2b309f2e602eba9c04a5290fb5aa0..1607e434c32548813c55e47a1cdc53ed9ecf36f9 100644 (file)
@@ -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)