From 1ad82145a54a8d96ba3ec9ff1094413fc10917f3 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 15 Jan 2023 23:41:32 +0100 Subject: [PATCH] Remove dead cleanup code This code path was only triggered if inst->cd == NULL. But the freeing only happens if inst->cd != NULL. There is nothing to free here, so remove this code. In fact, let's get rid of the goto too to make the code more clear to read. --- ext/standard/filters.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/ext/standard/filters.c b/ext/standard/filters.c index b390ac7b0a212..8cc1166cd9d0f 100644 --- a/ext/standard/filters.c +++ b/ext/standard/filters.c @@ -1301,20 +1301,13 @@ static int php_convert_filter_ctor(php_convert_filter *inst, inst->stub_len = 0; if ((inst->cd = php_conv_open(conv_mode, conv_opts, persistent)) == NULL) { - goto out_failure; + if (inst->filtername != NULL) { + pefree(inst->filtername, persistent); + } + return FAILURE; } return SUCCESS; - -out_failure: - if (inst->cd != NULL) { - php_conv_dtor(inst->cd); - pefree(inst->cd, persistent); - } - if (inst->filtername != NULL) { - pefree(inst->filtername, persistent); - } - return FAILURE; } static void php_convert_filter_dtor(php_convert_filter *inst)