vlc | branch: master | Thomas Guillem <[email protected]> | Thu Jun 29 16:55:58 2017 +0200| [4d767a78d54a8ddde56ea24824c299d47fa522d8] | committer: Thomas Guillem
gl: vaapi: fix VADisplay leak in error path > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4d767a78d54a8ddde56ea24824c299d47fa522d8 --- modules/video_output/opengl/converter_vaapi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/video_output/opengl/converter_vaapi.c b/modules/video_output/opengl/converter_vaapi.c index c6ff72fd8e..03987a8e34 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,14 +328,12 @@ 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)) { msg_Err(tc->gl, "VAAPI instance already in use"); + vadpy = NULL; goto error; } @@ -342,13 +342,16 @@ tc_vaegl_init(opengl_tex_converter_t *tc, VADisplay *vadpy) if (tc->fshader == 0) { vlc_vaapi_ReleaseInstance(priv->vadpy); + vadpy = NULL; goto error; } return VLC_SUCCESS; error: + if (vadpy != NULL) + vaTerminate(vadpy); free(tc->priv); - return VLC_EGENERIC; + return ret; } int _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
