diff options
author | Niklas Haas <git@haasn.dev> | 2022-02-27 19:36:10 +0100 |
---|---|---|
committer | Niklas Haas <github-daiK1o@haasn.dev> | 2022-03-03 13:06:05 +0100 |
commit | 4387f3bcd0744a81011f65f207e76d919f0cda90 (patch) | |
tree | bd9e9389ca23bc3258c96498bc193b2d52854a2f /video/out | |
parent | 7d08201a8f82c2dfdcbb794431d48867c46f03c2 (diff) | |
download | mpv-4387f3bcd0744a81011f65f207e76d919f0cda90.tar.bz2 mpv-4387f3bcd0744a81011f65f207e76d919f0cda90.tar.xz |
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.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/hwdec/hwdec_vaapi_gl.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/video/out/hwdec/hwdec_vaapi_gl.c b/video/out/hwdec/hwdec_vaapi_gl.c index 961771af80..ed72701fc2 100644 --- a/video/out/hwdec/hwdec_vaapi_gl.c +++ b/video/out/hwdec/hwdec_vaapi_gl.c @@ -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) |