i915, i965: Fix memory leak in intel_miptree_create_for_bo.

Fixes "Resource leak" defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
This commit is contained in:
Vinson Lee 2013-09-27 22:20:04 -07:00 committed by Chad Versace
parent ab2da985b6
commit 227872571a
2 changed files with 6 additions and 2 deletions

View file

@ -264,8 +264,10 @@ intel_miptree_create_for_bo(struct intel_context *intel,
0, 0,
width, height, 1,
true);
if (!mt)
if (!mt) {
free(region);
return mt;
}
region->cpp = mt->cpp;
region->width = width;

View file

@ -636,8 +636,10 @@ intel_miptree_create_for_bo(struct brw_context *brw,
0, 0,
width, height, 1,
true, 0 /* num_samples */);
if (!mt)
if (!mt) {
free(region);
return mt;
}
region->cpp = mt->cpp;
region->width = width;