vc4: Fix memory leaks of struct qinst.
This commit is contained in:
parent
f78ee1b280
commit
2147dd9681
|
@ -147,7 +147,7 @@ qir_opt_cse(struct vc4_compile *c)
|
||||||
qir_dump_inst(inst);
|
qir_dump_inst(inst);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
remove_from_list(&inst->link);
|
qir_remove_instruction(inst);
|
||||||
progress = true;
|
progress = true;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -54,8 +54,7 @@ qir_opt_dead_code(struct vc4_compile *c)
|
||||||
qir_dump_inst(inst);
|
qir_dump_inst(inst);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
remove_from_list(&inst->link);
|
qir_remove_instruction(inst);
|
||||||
free(inst);
|
|
||||||
progress = true;
|
progress = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,9 +282,23 @@ qir_compile_init(void)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
qir_remove_instruction(struct qinst *qinst)
|
||||||
|
{
|
||||||
|
remove_from_list(&qinst->link);
|
||||||
|
free(qinst->src);
|
||||||
|
free(qinst);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
qir_compile_destroy(struct vc4_compile *c)
|
qir_compile_destroy(struct vc4_compile *c)
|
||||||
{
|
{
|
||||||
|
while (!is_empty_list(&c->instructions)) {
|
||||||
|
struct qinst *qinst =
|
||||||
|
(struct qinst *)first_elem(&c->instructions);
|
||||||
|
qir_remove_instruction(qinst);
|
||||||
|
}
|
||||||
|
|
||||||
ralloc_free(c);
|
ralloc_free(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,6 +245,7 @@ struct qinst *qir_inst4(enum qop op, struct qreg dst,
|
||||||
struct qreg b,
|
struct qreg b,
|
||||||
struct qreg c,
|
struct qreg c,
|
||||||
struct qreg d);
|
struct qreg d);
|
||||||
|
void qir_remove_instruction(struct qinst *qinst);
|
||||||
void qir_emit(struct vc4_compile *c, struct qinst *inst);
|
void qir_emit(struct vc4_compile *c, struct qinst *inst);
|
||||||
struct qreg qir_get_temp(struct vc4_compile *c);
|
struct qreg qir_get_temp(struct vc4_compile *c);
|
||||||
int qir_get_op_nsrc(enum qop qop);
|
int qir_get_op_nsrc(enum qop qop);
|
||||||
|
|
Loading…
Reference in New Issue