diff options
author | Vinson Lee <[email protected]> | 2010-04-11 18:07:41 -0700 |
---|---|---|
committer | Vinson Lee <[email protected]> | 2010-04-11 18:07:41 -0700 |
commit | 8033d7542b37e92f9a79febbdf88b0573a65cfa5 (patch) | |
tree | 4707bbe670824498335879bf48741d38f4d05fde | |
parent | 039e77a7d1e4650d6ef45562522ede2a43379499 (diff) |
i915g: Fix possible null pointer deference in debug builds.
i915_buffer deferences buf in debug builds. Move declaration and
assignment to inside NULL check of buf.
-rw-r--r-- | src/gallium/drivers/i915/i915_state.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index bc2f1b268a0..397647204b4 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -527,7 +527,6 @@ static void i915_set_constant_buffer(struct pipe_context *pipe, struct pipe_resource *buf) { struct i915_context *i915 = i915_context(pipe); - struct i915_buffer *ir = i915_buffer(buf); draw_flush(i915->draw); assert(shader < PIPE_SHADER_TYPES); @@ -543,6 +542,7 @@ static void i915_set_constant_buffer(struct pipe_context *pipe, * N constants, leaving any extras from shader translation alone. */ if (buf) { + struct i915_buffer *ir = i915_buffer(buf); memcpy(i915->current.constants[shader], ir->data, ir->b.b.width0); i915->current.num_user_constants[shader] = (ir->b.b.width0 / 4 * sizeof(float)); |