From 9e20fe9bbb0df5cb2e1559c5429818391a9901c1 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Tue, 4 Dec 2018 16:23:09 +0000 Subject: [PATCH] Various mem leak fixes (#12400) --- libr/core/core.c | 1 + libr/core/disasm.c | 1 + libr/util/format.c | 1 + 3 files changed, 3 insertions(+) diff --git a/libr/core/core.c b/libr/core/core.c index bd8e26740d..719d1db8a7 100644 --- a/libr/core/core.c +++ b/libr/core/core.c @@ -594,6 +594,7 @@ static ut64 num_callback(RNum *userptr, const char *str, int *ok) { return r_reg_get_value (core->dbg->reg, r); } } + free (bptr); return 0; // UT64_MAX; } else { int rows; diff --git a/libr/core/disasm.c b/libr/core/disasm.c index 6c69369006..48d06557de 100644 --- a/libr/core/disasm.c +++ b/libr/core/disasm.c @@ -4472,6 +4472,7 @@ static void ds_print_calls_hints(RDisasmState *ds) { ds_begin_comment (ds); const char *fcn_type = r_type_func_ret (TDB, name); if (!fcn_type || !*fcn_type) { + free (name); return; } char *cmt = r_str_newf ("; %s%s%s(", fcn_type, diff --git a/libr/util/format.c b/libr/util/format.c index 2e0d96fea2..de7efcd7f3 100644 --- a/libr/util/format.c +++ b/libr/util/format.c @@ -1590,6 +1590,7 @@ int r_print_format_struct_size(const char *f, RPrint *p, int mode, int n) { if (newsize < 1) { eprintf ("Cannot find size for `%s'\n", format); free (structname); + free (o); return 0; } if (format && newsize > 0) {