struct pipe_screen *screen;
screen = api->create_screen(api, drmFD, arg);
+ if (!screen)
+ return NULL;
sww = wrapper_sw_winsys_warp_pipe_screen(screen);
+ if (!sww)
+ return NULL;
return softpipe_create_screen(sww);
}
{
struct sw_drm_api *swapi = CALLOC_STRUCT(sw_drm_api);
- swapi->base.name = "sw";
+ if (!swapi)
+ return api;
+
+ swapi->base.name = api->name;
swapi->base.driver_name = api->driver_name;
swapi->base.create_screen = sw_drm_create_screen;
swapi->base.destroy = sw_drm_destroy;
{
struct wrapper_sw_winsys *wsw = CALLOC_STRUCT(wrapper_sw_winsys);
+ if (!wsw)
+ goto err;
+
wsw->base.displaytarget_create = wsw_dt_create;
wsw->base.displaytarget_from_handle = wsw_dt_from_handle;
wsw->base.displaytarget_map = wsw_dt_map;
wsw->screen = screen;
wsw->pipe = screen->context_create(screen, NULL);
if (!wsw->pipe)
- goto err;
+ goto err_free;
return &wsw->base;
-err:
+err_free:
FREE(wsw);
+err:
return NULL;
}