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));