From 2b6fbe26acd1574a4bd6a0b0849f18e01250f705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 25 Apr 2024 00:20:01 +0200 Subject: [PATCH] core: remove check of NULL pointers before calling arraylist_free() (issue #865) --- src/core/core-calc.c | 6 ++---- src/core/hook/hook-command.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/core/core-calc.c b/src/core/core-calc.c index e9989b1a8..fbff90703 100644 --- a/src/core/core-calc.c +++ b/src/core/core-calc.c @@ -475,10 +475,8 @@ calc_expression (const char *expr) calc_format_result (value, str_result, sizeof (str_result)); end: - if (list_values) - arraylist_free (list_values); - if (list_ops) - arraylist_free (list_ops); + arraylist_free (list_values); + arraylist_free (list_ops); return strdup (str_result); } diff --git a/src/core/hook/hook-command.c b/src/core/hook/hook-command.c index b0eb0c09d..26a858ed7 100644 --- a/src/core/hook/hook-command.c +++ b/src/core/hook/hook-command.c @@ -490,8 +490,7 @@ hook_command_format_args_description (const char *args_description) return string_dyn_free (result, 0); error: - if (args) - arraylist_free (args); + arraylist_free (args); if (result) string_dyn_free (result, 1); if (lines)