From ba4be108363b3de8b6528c2b9d0cf69e06554285 Mon Sep 17 00:00:00 2001 From: zengwei2000 <102871671+zengwei2000@users.noreply.github.com> Date: Wed, 20 Dec 2023 11:33:35 +0800 Subject: [PATCH] fix the Memory leak: ret (#4038) When the opsize is greater than 2 and memory allocation is successful, it will cause a memory leak Signed-off-by: zengwei zengwei1@uniontech.com --- librz/analysis/p/analysis_avr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/librz/analysis/p/analysis_avr.c b/librz/analysis/p/analysis_avr.c index 91134e338ff..4cd6cc277be 100644 --- a/librz/analysis/p/analysis_avr.c +++ b/librz/analysis/p/analysis_avr.c @@ -379,6 +379,7 @@ static ut8 *analysis_mask_avr(RzAnalysis *analysis, int size, const ut8 *data, u rz_strbuf_fini(&sb); if (opsize < 2 || !(ret = malloc(opsize))) { + free(ret); rz_analysis_op_free(op); return NULL; }