From c69649ab0a3f95d97bdaa7695c9d3f4c43296d09 Mon Sep 17 00:00:00 2001 From: Otto van der Schaaf Date: Sun, 10 Feb 2019 23:42:44 +0100 Subject: [PATCH] Fix error handling in ps_create_XXX_conf (#1625) Return NULL instead of NGX_CONF_ERROR when config creation fails. Fixes https://github.com/apache/incubator-pagespeed-ngx/issues/1623 --- src/ngx_pagespeed.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ngx_pagespeed.cc b/src/ngx_pagespeed.cc index 4260b4ea2..e82956047 100644 --- a/src/ngx_pagespeed.cc +++ b/src/ngx_pagespeed.cc @@ -1028,7 +1028,7 @@ void* ps_create_main_conf(ngx_conf_t* cf) { } ps_main_conf_t* cfg_m = ps_create_conf(cf); if (cfg_m == NULL) { - return NGX_CONF_ERROR; + return NULL; } CHECK(!factory_deleted); NgxRewriteOptions::Initialize(); @@ -1049,7 +1049,7 @@ void* ps_create_main_conf(ngx_conf_t* cf) { void* ps_create_srv_conf(ngx_conf_t* cf) { ps_srv_conf_t* cfg_s = ps_create_conf(cf); if (cfg_s == NULL) { - return NGX_CONF_ERROR; + return NULL; } ps_set_conf_cleanup_handler(cf, ps_cleanup_srv_conf, cfg_s); return cfg_s; @@ -1058,7 +1058,7 @@ void* ps_create_srv_conf(ngx_conf_t* cf) { void* ps_create_loc_conf(ngx_conf_t* cf) { ps_loc_conf_t* cfg_l = ps_create_conf(cf); if (cfg_l == NULL) { - return NGX_CONF_ERROR; + return NULL; } ps_set_conf_cleanup_handler(cf, ps_cleanup_loc_conf, cfg_l); return cfg_l;