[vlc-commits] gl: vaapi: fix VADisplay leak in error path

Thomas Guillem git at videolan.org
Fri Jun 30 12:31:21 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jun 29 16:55:58 2017 +0200| [7cbd3b6b824e826d43021dac329c447e37a5699d] | committer: Thomas Guillem

gl: vaapi: fix VADisplay leak in error path

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

 modules/video_output/opengl/converter_vaapi.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/opengl/converter_vaapi.c b/modules/video_output/opengl/converter_vaapi.c
index c6ff72fd8e..6485eab8b7 100644
--- a/modules/video_output/opengl/converter_vaapi.c
+++ b/modules/video_output/opengl/converter_vaapi.c
@@ -296,10 +296,12 @@ tc_vaegl_init(opengl_tex_converter_t *tc, VADisplay *vadpy)
     if (vadpy == NULL)
         return VLC_EGENERIC;
 
+    int ret = VLC_ENOMEM;
     struct priv *priv = tc->priv = calloc(1, sizeof(struct priv));
     if (unlikely(tc->priv == NULL))
-        return VLC_ENOMEM;
+        goto error;
 
+    ret = VLC_EGENERIC;
     priv->vadpy = vadpy;
     priv->fourcc = 0;
 
@@ -326,10 +328,7 @@ tc_vaegl_init(opengl_tex_converter_t *tc, VADisplay *vadpy)
         goto error;
 
     if (tc_va_check_interop_blacklist(tc, priv->vadpy))
-    {
-        vaTerminate(priv->vadpy);
         goto error;
-    }
 
     if (vlc_vaapi_SetInstance(priv->vadpy))
     {
@@ -342,13 +341,15 @@ tc_vaegl_init(opengl_tex_converter_t *tc, VADisplay *vadpy)
     if (tc->fshader == 0)
     {
         vlc_vaapi_ReleaseInstance(priv->vadpy);
-        goto error;
+        free(tc->priv);
+        return ret;
     }
     return VLC_SUCCESS;
 
 error:
+    vaTerminate(vadpy);
     free(tc->priv);
-    return VLC_EGENERIC;
+    return ret;
 }
 
 int



More information about the vlc-commits mailing list