From: RĂ©mi Denis-Courmont Date: Sun, 14 Jul 2013 20:08:47 +0000 (+0300) Subject: vdpau: fix leak on picture pool error X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=40e38ac09311ad5cba0d7da3e983957ef8ed7455;hp=bf6976989e83f31d47ef7dafb18c68487bfc1ad4;p=vlc vdpau: fix leak on picture pool error (same problem as XCB) --- 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)