Fix memory leak

This commit is contained in:
lazymio 2021-12-31 00:24:18 +01:00
parent 3b667338cf
commit a06563ecdd
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873
3 changed files with 4 additions and 8 deletions

View File

@ -294,7 +294,7 @@ S390CPU *cpu_s390_init(struct uc_struct *uc, const char *cpu_model)
// init addresss space
cpu_address_space_init(cs, 0, cs->memory);
qemu_init_vcpu(cs);
//qemu_init_vcpu(cs);
return cpu;
}

View File

@ -414,6 +414,7 @@ void s390_cpu_model_finalize(CPUState *obj)
S390CPU *cpu = S390_CPU(obj);
g_free(cpu->model);
g_free(cpu->ss.keydata);
cpu->model = NULL;
}

View File

@ -16,10 +16,10 @@ static void s390_set_pc(struct uc_struct *uc, uint64_t address)
static void s390_release(void *ctx)
{
#if 0
int i;
TCGContext *tcg_ctx = (TCGContext *)ctx;
S390XCPU *cpu = (S390XCPU *)tcg_ctx->uc->cpu;
S390CPU *cpu = (S390CPU *)tcg_ctx->uc->cpu;
CPUTLBDesc *d = cpu->neg.tlb.d;
CPUTLBDescFast *f = cpu->neg.tlb.f;
CPUTLBDesc *desc;
@ -32,11 +32,6 @@ static void s390_release(void *ctx)
g_free(desc->iotlb);
g_free(fast->table);
}
#endif
TCGContext *tcg_ctx = (TCGContext *)ctx;
S390CPU *cpu = (S390CPU *)tcg_ctx->uc->cpu;
release_common(ctx);
s390_cpu_model_finalize((CPUState *)cpu);
// TODO: Anymore to free?