Fix leak of CS structs in librz/arch/p/analysis/analysis_riscv_cs.c (#6133)

This commit is contained in:
SSharshunov
2026-04-06 11:58:25 +00:00
committed by GitHub
parent c177cce9d4
commit f007f5f309
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -791,7 +791,7 @@ int analyze_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *buf
if (ret != CS_ERR_OK) {
goto fin;
}
cs_option(ctx->hndl, CS_OPT_DETAIL, CS_OPT_ON);
cs_option(ctx->hndl, CS_OPT_DETAIL, CS_OPT_ON | CS_OPT_DETAIL_REAL);
}
n = cs_disasm(ctx->hndl, (ut8 *)buf, len, addr, 1, &insn);
@@ -1931,7 +1931,6 @@ beach:
op_fillval(analysis, op, &ctx->hndl, insn);
}
cs_free(insn, n);
// cs_close (&handle);
fin:
return opsize;
}
@@ -2261,6 +2260,7 @@ static void set_stack_effect(RzAnalysisOp *op, cs_insn *insn) {
static bool riscv_fini(void *user) {
RiscvContext *ctx = (RiscvContext *)user;
if (ctx) {
cs_close(&ctx->hndl);
RZ_FREE(ctx);
}
return true;
+1 -1
View File
@@ -1,6 +1,6 @@
[wrap-git]
url = https://github.com/capstone-engine/capstone.git
revision = 3533a9c8d0713eac0d39532d91f6c7acfa23b3d6
revision = 7b1002db6bce9009f2cc5aa6e24380e38a1d51b9
directory = capstone-next
patch_directory = capstone-next
depth = 1