[vlc-commits] opengl/vdpau: fix leaks

Rémi Denis-Courmont git at videolan.org
Fri Dec 21 21:05:13 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Dec 21 21:52:14 2018 +0200| [a736cf4e854084fd469d986f310218cb55a2180e] | committer: Rémi Denis-Courmont

opengl/vdpau: fix leaks

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

 modules/video_output/opengl/converter_vdpau.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/opengl/converter_vdpau.c b/modules/video_output/opengl/converter_vdpau.c
index 4129f7bdf7..5671ea30b4 100644
--- a/modules/video_output/opengl/converter_vdpau.c
+++ b/modules/video_output/opengl/converter_vdpau.c
@@ -94,8 +94,10 @@ tc_vdpau_gl_get_pool(opengl_tex_converter_t const *tc,
             goto error;
 
         vlc_vdp_output_surface_t *picsys = malloc(sizeof (*picsys));
-        if (!picsys)
+        if (!picsys) {
+            vdp_output_surface_destroy(priv->vdp, surface);
             goto error;
+        }
 
         picsys->vdp = vdp_hold_x11(priv->vdp, NULL);
         picsys->device = priv->vdp_device;
@@ -106,8 +108,11 @@ tc_vdpau_gl_get_pool(opengl_tex_converter_t const *tc,
                                    .pf_destroy = pool_pic_destroy_cb };
 
         pics[i] = picture_NewFromResource(&tc->fmt, &rsc);
-        if (!pics[i])
+        if (!pics[i]) {
+            free(picsys);
+            vdp_output_surface_destroy(priv->vdp, surface);
             goto error;
+        }
     }
 
     picture_pool_t *pool = picture_pool_New(requested_count, pics);



More information about the vlc-commits mailing list