intel: callocing a 32 byte temp is silly, so don't
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 24 Jan 2013 04:35:19 +0000 (23:35 -0500)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 24 Jan 2013 18:57:46 +0000 (13:57 -0500)
I believe that the size used to vary, so the dynamic allocation is
necessary.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/intel/intel_context.c

index ab97d664f365e8bc4de5bda7d2ecd6f93849de5b..3aa35e6d7f5a1359129d6a3f2a9cd29cf2532579 100644 (file)
@@ -984,8 +984,8 @@ intel_query_dri2_buffers(struct intel_context *intel,
    __DRIscreen *screen = intel->intelScreen->driScrnPriv;
    struct gl_framebuffer *fb = drawable->driverPrivate;
    int i = 0;
-   const int max_attachments = 4;
-   unsigned *attachments = calloc(2 * max_attachments, sizeof(unsigned));
+   unsigned attachments[8];
+   const int max_attachments = ARRAY_SIZE(attachments) / 2;
 
    struct intel_renderbuffer *front_rb;
    struct intel_renderbuffer *back_rb;
@@ -993,6 +993,7 @@ intel_query_dri2_buffers(struct intel_context *intel,
    front_rb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT);
    back_rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
 
+   memset(attachments, 0, sizeof(attachments));
    if ((intel->is_front_buffer_rendering ||
        intel->is_front_buffer_reading ||
        !back_rb) && front_rb) {
@@ -1013,7 +1014,6 @@ intel_query_dri2_buffers(struct intel_context *intel,
                                                        attachments, i / 2,
                                                        buffer_count,
                                                        drawable->loaderPrivate);
-   free(attachments);
 }
 
 /**