mirror of https://github.com/mpv-player/mpv.git
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:
parent
7d08201a8f
commit
4387f3bcd0
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue