From 40e38ac09311ad5cba0d7da3e983957ef8ed7455 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sun, 14 Jul 2013 23:08:47 +0300 Subject: [PATCH] vdpau: fix leak on picture pool error (same problem as XCB) --- 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 e177102b72..1607e434c3 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) -- 2.39.2