Fix memory leak in PPC target.

This commit is contained in:
relapids 2022-08-15 15:56:25 -07:00
parent 336425b588
commit a3ccbf2e59
1 changed files with 15 additions and 0 deletions

View File

@ -109,6 +109,7 @@ static void ppc_release(void *ctx)
int i;
TCGContext *tcg_ctx = (TCGContext *)ctx;
PowerPCCPU *cpu = (PowerPCCPU *)tcg_ctx->uc->cpu;
CPUPPCState *env = &cpu->env;
CPUTLBDesc *d = cpu->neg.tlb.d;
CPUTLBDescFast *f = cpu->neg.tlb.f;
CPUTLBDesc *desc;
@ -132,6 +133,20 @@ static void ppc_release(void *ctx)
// g_free(tcg_ctx->tb_ctx.tbs);
if (env->nb_tlb != 0) {
switch(env->tlb_type) {
case TLB_6XX:
g_free(env->tlb.tlb6);
break;
case TLB_EMB:
g_free(env->tlb.tlbe);
break;
case TLB_MAS:
g_free(env->tlb.tlbm);
break;
}
}
ppc_cpu_instance_finalize(tcg_ctx->uc->cpu);
ppc_cpu_unrealize(tcg_ctx->uc->cpu);
}