mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 19:58:09 +02:00
egl/dri2: NULL check value returned by dri2_create_surface
dri2_create_surface can fail for a variety of reasons, including bad
input data. Dereferencing the NULL pointer and crashing is not okay.
Fixes issue identified by Klocwork analysis:
Pointer 'surf' returned from call to function 'dri2_create_surface'
at line 285 may be NULL and will be dereferenced at line 291.
NOTE: This is a candidate for the stable branches.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit f730c210b8)
This commit is contained in:
parent
93613693ad
commit
e928a3059c
1 changed files with 8 additions and 7 deletions
|
|
@ -284,14 +284,15 @@ dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
|
|||
|
||||
surf = dri2_create_surface(drv, disp, EGL_WINDOW_BIT, conf,
|
||||
window, attrib_list);
|
||||
if (surf != NULL) {
|
||||
/* When we first create the DRI2 drawable, its swap interval on the
|
||||
* server side is 1.
|
||||
*/
|
||||
surf->SwapInterval = 1;
|
||||
|
||||
/* When we first create the DRI2 drawable, its swap interval on the server
|
||||
* side is 1.
|
||||
*/
|
||||
surf->SwapInterval = 1;
|
||||
|
||||
/* Override that with a driconf-set value. */
|
||||
drv->API.SwapInterval(drv, disp, surf, dri2_dpy->default_swap_interval);
|
||||
/* Override that with a driconf-set value. */
|
||||
drv->API.SwapInterval(drv, disp, surf, dri2_dpy->default_swap_interval);
|
||||
}
|
||||
|
||||
return surf;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue