egl/drm: plug memory leak
Free the memory for dri2_surf in the unlikely case that one provides NULL for native_window. Also set the relevant EGL_ERROR to provide feedback to the user. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
879dcf07f6
commit
6098ef8244
|
@ -115,8 +115,11 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
|
|||
|
||||
switch (type) {
|
||||
case EGL_WINDOW_BIT:
|
||||
if (!window)
|
||||
return NULL;
|
||||
if (!window) {
|
||||
_eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
|
||||
goto cleanup_surf;
|
||||
}
|
||||
|
||||
surf = gbm_dri_surface(window);
|
||||
dri2_surf->gbm_surf = surf;
|
||||
dri2_surf->base.Width = surf->base.width;
|
||||
|
|
Loading…
Reference in New Issue