Skip to content

Commit 9006f06

Browse files
authoredJan 16, 2023
Remove dead cleanup code (#10333)
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.
1 parent c010e8f commit 9006f06

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed
 

‎ext/standard/filters.c

+4-11
Original file line numberDiff line numberDiff line change
@@ -1301,20 +1301,13 @@ static int php_convert_filter_ctor(php_convert_filter *inst,
13011301
inst->stub_len = 0;
13021302

13031303
if ((inst->cd = php_conv_open(conv_mode, conv_opts, persistent)) == NULL) {
1304-
goto out_failure;
1304+
if (inst->filtername != NULL) {
1305+
pefree(inst->filtername, persistent);
1306+
}
1307+
return FAILURE;
13051308
}
13061309

13071310
return SUCCESS;
1308-
1309-
out_failure:
1310-
if (inst->cd != NULL) {
1311-
php_conv_dtor(inst->cd);
1312-
pefree(inst->cd, persistent);
1313-
}
1314-
if (inst->filtername != NULL) {
1315-
pefree(inst->filtername, persistent);
1316-
}
1317-
return FAILURE;
13181311
}
13191312

13201313
static void php_convert_filter_dtor(php_convert_filter *inst)

0 commit comments

Comments
 (0)