trace: remove useless MALLOC() in trace_context_draw_vbo()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 7 Feb 2016 21:33:33 +0000 (22:33 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 7 Feb 2016 23:06:22 +0000 (00:06 +0100)
There is no need to allocate memory when unwrapping the indirect buf.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/drivers/trace/tr_context.c

index 4d03fe1ee0b48c6fdcbb4a2ad5fa0610e5bfc41c..066a0ee3d5c694ce3bf487c4de8204c5f7d1e9d1 100644 (file)
@@ -120,18 +120,13 @@ trace_context_draw_vbo(struct pipe_context *_pipe,
    trace_dump_trace_flush();
 
    if (info->indirect) {
-      struct pipe_draw_info *_info = NULL;
+      struct pipe_draw_info _info;
 
-      _info = MALLOC(sizeof(*_info));
-      if (!_info)
-         return;
-
-      memcpy(_info, info, sizeof(*_info));
-      _info->indirect = trace_resource_unwrap(tr_ctx, _info->indirect);
-      _info->indirect_params = trace_resource_unwrap(tr_ctx,
-                                                     _info->indirect_params);
-      pipe->draw_vbo(pipe, _info);
-      FREE(_info);
+      memcpy(&_info, info, sizeof(_info));
+      _info.indirect = trace_resource_unwrap(tr_ctx, _info.indirect);
+      _info.indirect_params = trace_resource_unwrap(tr_ctx,
+                                                    _info.indirect_params);
+      pipe->draw_vbo(pipe, &_info);
    } else {
       pipe->draw_vbo(pipe, info);
    }