meta: Avoid random memory access on error
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Sat, 16 Apr 2016 19:26:22 +0000 (22:26 +0300)
committerChad Versace <chad.versace@intel.com>
Tue, 26 Apr 2016 21:54:02 +0000 (14:54 -0700)
Initialize drawFb to NULL in _mesa_meta_CopyImageSubData_uncompressed()
if getting readFb fails uninitialized drawFb will cause randomness
on cleanup.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
src/mesa/drivers/common/meta_copy_image.c

index 9402a4652eb53885af9a7617c8a10ccd00f0062a..ebea4285c9a93e9a5d5b6e689c8bddb4956d9637 100644 (file)
@@ -168,7 +168,7 @@ _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx,
    GLuint src_view_texture = 0;
    struct gl_texture_image *src_view_tex_image;
    struct gl_framebuffer *readFb;
-   struct gl_framebuffer *drawFb;
+   struct gl_framebuffer *drawFb = NULL;
    bool success = false;
    GLbitfield mask;
    GLenum status, attachment;