XCB/X11: fix long-standing massive leak on error
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 14 Jul 2013 19:43:42 +0000 (22:43 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 14 Jul 2013 19:43:42 +0000 (22:43 +0300)
modules/video_output/xcb/x11.c

index cd80029..7b0d373 100644 (file)
@@ -406,13 +406,15 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
             break;
         }
     }
+    xcb_flush (sys->conn);
 
     if (count == 0)
         return NULL;
 
     sys->pool = picture_pool_New (count, pic_array);
-    /* TODO release picture resources if NULL */
-    xcb_flush (sys->conn);
+    if (unlikely(sys->pool == NULL))
+        while (count > 0)
+            picture_Release(pic_array[--count]);
     return sys->pool;
 }