hwdec_vaapi_gl: properly zero initialize priv struct

Easiest way is by just using a designated struct initializer. If we
don't, `p->images` ends up inheriting random data, which leaks into e.g.
eglDestroyImageKHR.

It's a small miracle this never blew up before. Or maybe it did. Who
knows.
This commit is contained in:
Niklas Haas 2022-02-27 19:36:10 +01:00 committed by Niklas Haas
parent 7d08201a8f
commit 4387f3bcd0
1 changed files with 8 additions and 6 deletions

View File

@ -73,12 +73,14 @@ static bool vaapi_gl_mapper_init(struct ra_hwdec_mapper *mapper,
struct vaapi_gl_mapper_priv *p = talloc_ptrtype(NULL, p);
p_mapper->interop_mapper_priv = p;
// EGL_KHR_image_base
p->CreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR");
p->DestroyImageKHR = (void *)eglGetProcAddress("eglDestroyImageKHR");
// GL_OES_EGL_image
p->EGLImageTargetTexture2DOES =
(void *)eglGetProcAddress("glEGLImageTargetTexture2DOES");
*p = (struct vaapi_gl_mapper_priv) {
// EGL_KHR_image_base
.CreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR"),
.DestroyImageKHR = (void *)eglGetProcAddress("eglDestroyImageKHR"),
// GL_OES_EGL_image
.EGLImageTargetTexture2DOES =
(void *)eglGetProcAddress("glEGLImageTargetTexture2DOES"),
};
if (!p->CreateImageKHR || !p->DestroyImageKHR ||
!p->EGLImageTargetTexture2DOES)