summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/sw
diff options
context:
space:
mode:
authorJakob Bornecrantz <wallbraker@gmail.com>2010-04-10 13:41:22 +0200
committerJakob Bornecrantz <wallbraker@gmail.com>2010-04-12 01:50:52 +0200
commitcefe2a1dc258e4c1fe75a5cf7c3d6804a616366d (patch)
tree3e41da834b4957799ef71e619f83cc1bffba71cc /src/gallium/winsys/sw
parentc81f049794625c6907c884fdb03de8dd1555b11e (diff)
winsys/sw: Fix error paths
Diffstat (limited to 'src/gallium/winsys/sw')
-rw-r--r--src/gallium/winsys/sw/drm/sw_drm_api.c9
-rw-r--r--src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c8
2 files changed, 14 insertions, 3 deletions
diff --git a/src/gallium/winsys/sw/drm/sw_drm_api.c b/src/gallium/winsys/sw/drm/sw_drm_api.c
index eb81d26a59..2ccde610e6 100644
--- a/src/gallium/winsys/sw/drm/sw_drm_api.c
+++ b/src/gallium/winsys/sw/drm/sw_drm_api.c
@@ -65,8 +65,12 @@ sw_drm_create_screen(struct drm_api *_api, int drmFD,
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);
}
@@ -86,7 +90,10 @@ sw_drm_api_create(struct drm_api *api)
{
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;
diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
index 9a68d9faff..d4d4270eb8 100644
--- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
+++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
@@ -262,6 +262,9 @@ wrapper_sw_winsys_warp_pipe_screen(struct pipe_screen *screen)
{
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;
@@ -272,11 +275,12 @@ wrapper_sw_winsys_warp_pipe_screen(struct pipe_screen *screen)
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;
}