[Mesa-dev] [PATCH] freedreno: fix some leaks
Ilia Mirkin
imirkin at alum.mit.edu
Sun Sep 27 17:58:47 PDT 2015
Freeing the compiler in the common destroy function is a sad hack, but
it's too annoying to create separate destroy functions.
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
src/gallium/drivers/freedreno/freedreno_context.c | 2 ++
src/gallium/drivers/freedreno/freedreno_screen.c | 4 ++++
src/gallium/drivers/freedreno/ir3/ir3.c | 1 +
src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c | 2 ++
4 files changed, 9 insertions(+)
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index 0b6b9fb..5b7c32f 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -160,6 +160,8 @@ fd_context_destroy(struct pipe_context *pctx)
if (ctx->primconvert)
util_primconvert_destroy(ctx->primconvert);
+ util_unreference_framebuffer_state(&ctx->framebuffer);
+
util_slab_destroy(&ctx->transfer_pool);
fd_ringmarker_del(ctx->draw_start);
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index 208d8d2..0bd8f60 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -37,6 +37,7 @@
#include "util/u_format_s3tc.h"
#include "util/u_string.h"
#include "util/u_debug.h"
+#include "util/ralloc.h"
#include "os/os_time.h"
@@ -119,6 +120,9 @@ fd_screen_destroy(struct pipe_screen *pscreen)
if (screen->dev)
fd_device_del(screen->dev);
+ if (screen->compiler)
+ ralloc_free(screen->compiler);
+
free(screen);
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.c b/src/gallium/drivers/freedreno/ir3/ir3.c
index 389d9a0..0c05af3 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3.c
@@ -95,6 +95,7 @@ void ir3_destroy(struct ir3 *shader)
free(shader->indirects);
free(shader->predicates);
free(shader->baryfs);
+ free(shader->keeps);
free(shader);
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
index d193da1..67131f6 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_compiler_nir.c
@@ -298,6 +298,8 @@ compile_error(struct ir3_compile *ctx, const char *format, ...)
static void
compile_free(struct ir3_compile *ctx)
{
+ if (ctx->s)
+ ralloc_free(ctx->s);
ralloc_free(ctx);
}
--
2.4.9
More information about the mesa-dev
mailing list