From 856cc81990955ad079d73b3cef7b9b2b376aae03 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Mon, 22 Apr 2024 13:59:52 -0500 Subject: [PATCH] Fix memleaks --- librz/arch/op.c | 6 ++---- librz/core/cgraph.c | 5 ++++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/librz/arch/op.c b/librz/arch/op.c index 2b3097c965a..82727332305 100644 --- a/librz/arch/op.c +++ b/librz/arch/op.c @@ -713,10 +713,7 @@ RZ_API void rz_analysis_insn_word_free(RZ_OWN RZ_NULLABLE RzAnalysisInsnWord *iw if (!iword) { return; } - rz_strbuf_free(iword->asm_str); - rz_pvector_free(iword->insns); - set_u_free(iword->jump_targets); - set_u_free(iword->call_targets); + rz_analysis_insn_word_fini(iword); free(iword); } @@ -740,5 +737,6 @@ RZ_API void rz_analysis_insn_word_fini(RZ_OWN RZ_NULLABLE RzAnalysisInsnWord *iw rz_pvector_free(iword->insns); set_u_free(iword->jump_targets); set_u_free(iword->call_targets); + rz_il_op_effect_free(iword->il_op); rz_mem_memzero(iword, sizeof(RzAnalysisInsnWord)); } diff --git a/librz/core/cgraph.c b/librz/core/cgraph.c index ac64adf36f9..b1789cbc087 100644 --- a/librz/core/cgraph.c +++ b/librz/core/cgraph.c @@ -856,7 +856,8 @@ static void extend_icfg(const RzAnalysis *analysis, RZ_BORROW RzGraph /*type != RZ_ANALYSIS_XREF_TYPE_CALL) { continue; } @@ -874,6 +875,7 @@ static void extend_icfg(const RzAnalysis *analysis, RZ_BORROW RzGraph /**/ *rz_core_graph_cfg_iwords(RZ_NONNU return graph; error: + rz_analysis_insn_word_fini(&cur_iword); rz_warn_if_reached(); rz_graph_free(graph); graph = NULL;