Mesa (master): vc4: Fix leak of a copy of the scheduled QPU instructions.

Eric Anholt anholt at kemper.freedesktop.org
Mon Dec 15 07:12:46 UTC 2014


Module: Mesa
Branch: master
Commit: 4da9e3d80556253a05179c398ffb1c3120fa3089
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4da9e3d80556253a05179c398ffb1c3120fa3089

Author: Eric Anholt <eric at anholt.net>
Date:   Sun Dec 14 20:28:13 2014 -0800

vc4: Fix leak of a copy of the scheduled QPU instructions.

They're copied into a vc4_bo after compiling is done.

---

 src/gallium/drivers/vc4/vc4_qpu.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_qpu.c b/src/gallium/drivers/vc4/vc4_qpu.c
index faf8790..83bf105 100644
--- a/src/gallium/drivers/vc4/vc4_qpu.c
+++ b/src/gallium/drivers/vc4/vc4_qpu.c
@@ -22,6 +22,7 @@
  */
 
 #include <stdbool.h>
+#include "util/ralloc.h"
 #include "vc4_qir.h"
 #include "vc4_qpu.h"
 
@@ -460,8 +461,8 @@ qpu_serialize_one_inst(struct vc4_compile *c, uint64_t inst)
 {
         if (c->qpu_inst_count >= c->qpu_inst_size) {
                 c->qpu_inst_size = MAX2(16, c->qpu_inst_size * 2);
-                c->qpu_insts = realloc(c->qpu_insts,
-                                       c->qpu_inst_size * sizeof(uint64_t));
+                c->qpu_insts = reralloc(c, c->qpu_insts,
+                                        uint64_t, c->qpu_inst_size);
         }
         c->qpu_insts[c->qpu_inst_count++] = inst;
 }




More information about the mesa-commit mailing list