summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2014-09-29 16:08:55 -0600
committerBrian Paul <brianp@vmware.com>2014-09-30 12:09:14 -0600
commit6b65847835b63a254c374a3562b54c5d58559c19 (patch)
tree0d40266702aad14713adf89519def5b6546d1acd
parentb12899d752ef04ab6ac55a5bee10532b5a4ad6ce (diff)
llvmpipe: move lp_jit_screen_init() call after allocation of screen object
The screen argument isn't actually used by lp_jit_screen_init() at this time, but let's move the call so that we pass a valid pointer. v2: don't leak screen if lp_jit_screen_init() fails. Reviewed-by: Roland Scheidegger <sroland@vmware.com>
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 30253222910..a264f990d02 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -557,9 +557,6 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
return NULL;
#endif
- if (!lp_jit_screen_init(screen))
- return NULL;
-
#ifdef DEBUG
LP_DEBUG = debug_get_flags_option("LP_DEBUG", lp_debug_flags, 0 );
#endif
@@ -570,6 +567,11 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
if (!screen)
return NULL;
+ if (!lp_jit_screen_init(screen)) {
+ FREE(screen);
+ return NULL;
+ }
+
screen->winsys = winsys;
screen->base.destroy = llvmpipe_destroy_screen;