mirror of
https://github.com/rizinorg/rizin.git
synced 2026-10-12 02:21:57 +00:00
Fix leak of CS structs in librz/arch/p/analysis/analysis_riscv_cs.c (#6133)
This commit is contained in:
@@ -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,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
|
||||
|
||||
Reference in New Issue
Block a user