From bd6793372b51f12ecd4865313f4abaa5a4f6c136 Mon Sep 17 00:00:00 2001 From: Heiko Weber Date: Thu, 7 Jul 2022 15:51:09 +0200 Subject: [PATCH] FPM: Fix possible double free on configuration load failure. Closes #8948. --- NEWS | 1 + sapi/fpm/fpm/fpm_conf.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ccacc0e7f9e..dcebfea1533 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ PHP NEWS - FPM: . Fixed zlog message prepend, free on incorrect address. (Heiko Weber) + . Fixed possible double free on configuration loading failure. (Heiko Weber). - GD: . Fixed bug GH-8848 (imagecopyresized() error refers to the wrong argument). diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 32935b57a75..31336292d52 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -1622,7 +1622,10 @@ int fpm_conf_load_ini_file(char *filename) /* {{{ */ tmp = zend_parse_ini_string(buf, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t)fpm_conf_ini_parser, &error); ini_filename = filename; if (error || tmp == FAILURE) { - if (ini_include) free(ini_include); + if (ini_include) { + free(ini_include); + ini_include = NULL; + } ini_recursion--; close(fd); free(buf);