pan/midgard: Allocate `dependencies` on stack
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 21 Aug 2019 15:53:49 +0000 (08:53 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 21 Aug 2019 17:38:30 +0000 (10:38 -0700)
It's small; this way we don't leak memory.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/midgard_schedule.c

index ab96a4b8fff36957920559cd19d42ec25b7709c0..66502813748d3d752fcb5456ab552bb9349768d6 100644 (file)
@@ -136,7 +136,10 @@ can_writeout_fragment(compiler_context *ctx, midgard_instruction **bundle, unsig
         uint8_t r0_written_mask = 0x0;
 
         /* Simultaneously we scan for the set of dependencies */
-        BITSET_WORD *dependencies = calloc(sizeof(BITSET_WORD), BITSET_WORDS(node_count));
+
+        size_t sz = sizeof(BITSET_WORD) * BITSET_WORDS(node_count);
+        BITSET_WORD *dependencies = alloca(sz);
+        memset(dependencies, 0, sz);
 
         for (unsigned i = 0; i < count; ++i) {
                 midgard_instruction *ins = bundle[i];