clover: Stop leaking NIR shaders
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 8 Oct 2020 15:41:31 +0000 (10:41 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 8 Oct 2020 16:01:38 +0000 (16:01 +0000)
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7068>

src/gallium/frontends/clover/nir/invocation.cpp

index 4e7b88d..9eb353d 100644 (file)
@@ -342,12 +342,16 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
       blob_init(&blob);
       nir_serialize(&blob, nir, false);
 
+      ralloc_free(nir);
+
       const pipe_binary_program_header header { uint32_t(blob.size) };
       module::section text { section_id, module::section::text_executable, header.num_bytes, {} };
       text.data.insert(text.data.end(), reinterpret_cast<const char *>(&header),
                        reinterpret_cast<const char *>(&header) + sizeof(header));
       text.data.insert(text.data.end(), blob.data, blob.data + blob.size);
 
+      free(blob.data);
+
       m.syms.emplace_back(sym.name, std::string(),
                           sym.reqd_work_group_size, section_id, 0, args);
       m.secs.push_back(text);