Mesa (master): st/mesa: check if _mesa_create_context() returns NULL

Brian Paul brianp at kemper.freedesktop.org
Tue Jul 12 14:31:15 UTC 2011


Module: Mesa
Branch: master
Commit: 1ab5e1524258042e26c769221f61da16403d0cf6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ab5e1524258042e26c769221f61da16403d0cf6

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Mon Jul 11 15:42:15 2011 +0100

st/mesa: check if _mesa_create_context() returns NULL

In some cases _mesa_create_context() can return NULL an in the mesa
state tracker, we do not concider the case, which may cause issues
within st_create_context_priv()

This patch adds a simple check (similar to the one in the dri drivers)

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
Signed-off-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/state_tracker/st_context.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 6eddbfc..6d4bc54 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -179,6 +179,9 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
    st_init_driver_functions(&funcs);
 
    ctx = _mesa_create_context(api, visual, shareCtx, &funcs, NULL);
+   if (!ctx) {
+      return NULL;
+   }
 
    /* XXX: need a capability bit in gallium to query if the pipe
     * driver prefers DP4 or MUL/MAD for vertex transformation.




More information about the mesa-commit mailing list