[Mesa-dev] [PATCH] intel: Move irb null check before dereference.
Vinson Lee
vlee at freedesktop.org
Tue Jun 25 21:17:03 PDT 2013
Fixes "Dereference before null check" defect reported by Coverity.
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
src/mesa/drivers/dri/intel/intel_tex_copy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index d018cec..4265257 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -64,13 +64,13 @@ intel_copy_texsubimage(struct intel_context *intel,
* however the hardware blitter can't handle this case, so fall back to
* meta (which can, since it uses ReadPixels).
*/
- if (irb->Base.Base.NumSamples != 0)
+ if (!irb || irb->Base.Base.NumSamples != 0)
return false;
/* glCopyTexSubImage() can't be called on a multisampled texture. */
assert(intelImage->base.Base.NumSamples == 0);
- if (!intelImage->mt || !irb || !irb->mt) {
+ if (!intelImage->mt || !irb->mt) {
if (unlikely(INTEL_DEBUG & DEBUG_PERF))
fprintf(stderr, "%s fail %p %p (0x%08x)\n",
__FUNCTION__, intelImage->mt, irb, internalFormat);
--
1.7.9.5
More information about the mesa-dev
mailing list