On 21 February 2018 at 14:41, Emil Velikov <[email protected]> wrote: > On 21 February 2018 at 14:26, Chuck Atkins <[email protected]> wrote: >> This fixes a segfault exposed by a29d63ecf7 which occurs when swr is >> used on an unsupported architecture. >> >> Signed-off-by: Chuck Atkins <[email protected]> >> Cc: [email protected] >> Cc: George Kyriazis <[email protected]> >> Cc: Bruce Cherniak <[email protected]> >> --- >> src/gallium/state_trackers/glx/xlib/xm_api.c | 11 +++++++---- >> 1 file changed, 7 insertions(+), 4 deletions(-) >> >> diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c >> b/src/gallium/state_trackers/glx/xlib/xm_api.c >> index 934c0aba11..3aec57e85d 100644 >> --- a/src/gallium/state_trackers/glx/xlib/xm_api.c >> +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c >> @@ -182,9 +182,12 @@ xmesa_close_display(Display *display) >> * } >> */ >> >> - if (xmdpy->smapi->destroy) >> - xmdpy->smapi->destroy(xmdpy->smapi); >> - free(xmdpy->smapi); >> + if (xmdpy->smapi) >> + { >> + if (xmdpy->smapi->destroy) >> + xmdpy->smapi->destroy(xmdpy->smapi); >> + free(xmdpy->smapi); >> + } >> >> XFree((char *) info); >> } >> @@ -767,7 +770,7 @@ XMesaVisual XMesaCreateVisual( Display *display, >> XMesaVisual v; >> GLint red_bits, green_bits, blue_bits, alpha_bits; >> >> - if (!xmdpy) >> + if (!xmdpy || !xmdpy->screen) >> return NULL; >> > Something doesn't look quite right - it seems that xmesa_init_display > should be fixed instead. > > Currently it returns non-NULL when either of the following fail: > - driver.create_pipe_screen() > - CALLOC_STRUCT > > I would add an explicit check after those + goto err_path. > The latter of which doing some proper teardown. Note: that there's a > leak in there - one should walk, detach & free the new entry from the > MesaExtInfo list. > As it always happens, just remembered that the classic xlib-glx (src/mesa/drivers/x11/) might need a similar fix.
-Emil _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
