From 77063f42745b4130fc25e47d34f67b86d0c821d5 Mon Sep 17 00:00:00 2001 From: benchea dan Date: Mon, 7 Nov 2022 18:06:15 +0200 Subject: [PATCH] close file --- ngx_http_js_challenge.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ngx_http_js_challenge.c b/ngx_http_js_challenge.c index 88d4780..bb1faf7 100644 --- a/ngx_http_js_challenge.c +++ b/ngx_http_js_challenge.c @@ -169,11 +169,13 @@ static char *ngx_http_js_challenge_merge_loc_conf(ngx_conf_t *cf, void *parent, if (fd < 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "js_challenge_html: Could not open file '%s': %s", path, strerror(errno)); + close(fd); return NGX_CONF_ERROR; } conf->html = ngx_palloc(cf->pool, info.st_size); int ret = read(fd, conf->html, info.st_size); + close(fd); if (ret < 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "js_challenge_html: Could not read file '%s': %s", path, strerror(errno));