diff options
Diffstat (limited to 'src/arch/processor.c')
-rw-r--r-- | src/arch/processor.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/arch/processor.c b/src/arch/processor.c index 05e3206..dccd12e 100644 --- a/src/arch/processor.c +++ b/src/arch/processor.c @@ -190,8 +190,18 @@ static void g_arch_processor_dispose(GArchProcessor *proc) size_t i; /* Boucle de parcours */ for (i = 0; i < proc->instr_count; i++) + { + /** + * Pour éviter un cycle de maintien des références, on détruit tous + * les liens depuis l'extérieur ! + */ + if (proc->instructions[i] != NULL) + g_arch_instruction_delete_all_links(proc->instructions[i]); + g_clear_object(&proc->instructions[i]); + } + g_mutex_clear(&proc->mutex); g_mutex_clear(&proc->error_mutex); @@ -230,6 +240,9 @@ static void g_arch_processor_finalize(GArchProcessor *proc) } + if (proc->coverages != NULL) + free(proc->coverages); + G_OBJECT_CLASS(g_arch_processor_parent_class)->finalize(G_OBJECT(proc)); } @@ -974,8 +987,7 @@ static void g_arch_processor_add_new_coverage(GArchProcessor *proc, GArchInstruc { proc->cov_allocated += COV_ALLOC_BLOCK; - proc->coverages = (instr_coverage *)realloc(proc->coverages, - proc->cov_allocated * sizeof(instr_coverage)); + proc->coverages = realloc(proc->coverages, proc->cov_allocated * sizeof(instr_coverage)); } |