vc4: Fix memory leaks of some vc4_compile contents.
This commit is contained in:
parent
50292d76c5
commit
f78ee1b280
|
@ -28,6 +28,7 @@
|
|||
#include "util/u_hash_table.h"
|
||||
#include "util/u_hash.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/ralloc.h"
|
||||
#include "tgsi/tgsi_dump.h"
|
||||
#include "tgsi/tgsi_info.h"
|
||||
|
||||
|
@ -1312,14 +1313,14 @@ vc4_shader_tgsi_to_qir(struct vc4_compiled_shader *shader, enum qstage stage,
|
|||
c->stage = stage;
|
||||
|
||||
/* XXX sizing */
|
||||
c->temps = calloc(sizeof(struct qreg), 1024);
|
||||
c->inputs = calloc(sizeof(struct qreg), 8 * 4);
|
||||
c->outputs = calloc(sizeof(struct qreg), 1024);
|
||||
c->uniforms = calloc(sizeof(struct qreg), 1024);
|
||||
c->consts = calloc(sizeof(struct qreg), 1024);
|
||||
c->temps = ralloc_array(c, struct qreg, 1024);
|
||||
c->inputs = ralloc_array(c, struct qreg, 8 * 4);
|
||||
c->outputs = ralloc_array(c, struct qreg, 1024);
|
||||
c->uniforms = ralloc_array(c, struct qreg, 1024);
|
||||
c->consts = ralloc_array(c, struct qreg, 1024);
|
||||
|
||||
c->uniform_data = calloc(sizeof(uint32_t), 1024);
|
||||
c->uniform_contents = calloc(sizeof(enum quniform_contents), 1024);
|
||||
c->uniform_data = ralloc_array(c, uint32_t, 1024);
|
||||
c->uniform_contents = ralloc_array(c, enum quniform_contents, 1024);
|
||||
|
||||
c->shader_state = key->shader_state;
|
||||
ret = tgsi_parse_init(&c->parser, c->shader_state->tokens);
|
||||
|
@ -1383,7 +1384,6 @@ vc4_shader_tgsi_to_qir(struct vc4_compiled_shader *shader, enum qstage stage,
|
|||
}
|
||||
|
||||
tgsi_parse_free(&c->parser);
|
||||
free(c->temps);
|
||||
|
||||
qir_optimize(c);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_simple_list.h"
|
||||
#include "util/ralloc.h"
|
||||
|
||||
#include "vc4_qir.h"
|
||||
#include "vc4_qpu.h"
|
||||
|
@ -274,7 +275,7 @@ qir_reg_equals(struct qreg a, struct qreg b)
|
|||
struct vc4_compile *
|
||||
qir_compile_init(void)
|
||||
{
|
||||
struct vc4_compile *c = CALLOC_STRUCT(vc4_compile);
|
||||
struct vc4_compile *c = rzalloc(NULL, struct vc4_compile);
|
||||
|
||||
make_empty_list(&c->instructions);
|
||||
|
||||
|
@ -284,7 +285,7 @@ qir_compile_init(void)
|
|||
void
|
||||
qir_compile_destroy(struct vc4_compile *c)
|
||||
{
|
||||
free(c);
|
||||
ralloc_free(c);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
Loading…
Reference in New Issue