summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2013-06-26 13:53:15 -0700
committerChad Versace <[email protected]>2013-06-27 13:16:47 -0700
commit6b676e66343356d5096260c2bc1601014c808cb0 (patch)
tree4cc8efc69a0f3d7a44ce8d41d394acd4330337bb /src
parent670f829102f45263f32826ec2dbbbf5c367b5f54 (diff)
i965,i915: Return early if miptree allocation fails
If allocation fails in intel_miptree_create_layout(), don't proceed to dereference the miptree. Return an early NULL. Fixes static analysis error reported by Klocwork. Note: This is a candidate for the 9.1 branch. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/intel_mipmap_tree.c2
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c
index 1776a4b34c5..058cfbe1bcc 100644
--- a/src/mesa/drivers/dri/i915/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i915/intel_mipmap_tree.c
@@ -260,6 +260,8 @@ intel_miptree_create_layout(struct intel_context *intel,
GLuint num_samples)
{
struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1);
+ if (!mt)
+ return NULL;
DBG("%s target %s format %s level %d..%d <-- %p\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target),
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 1776a4b34c5..058cfbe1bcc 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -260,6 +260,8 @@ intel_miptree_create_layout(struct intel_context *intel,
GLuint num_samples)
{
struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1);
+ if (!mt)
+ return NULL;
DBG("%s target %s format %s level %d..%d <-- %p\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(target),