Skip to content

Commit bb06315

Browse files
committed
bugfix: uninitialized fd might be closed
1 parent 10cc308 commit bb06315

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ngx_http_zstd_filter_module.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,8 @@ ngx_http_zstd_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
764764
ngx_conf_merge_bufs_value(conf->bufs, prev->bufs,
765765
(128 * 1024) / ngx_pagesize, ngx_pagesize);
766766

767-
#if (NGX_SUPPRESS_WARN)
768767
buf = NULL;
769-
#endif
768+
fd = -1;
770769

771770
zmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_zstd_filter_module);
772771

@@ -838,7 +837,7 @@ ngx_http_zstd_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
838837

839838
close:
840839

841-
if (ngx_close_file(fd) == NGX_FILE_ERROR) {
840+
if (fd != NGX_INVALID_FILE && ngx_close_file(fd) == NGX_FILE_ERROR) {
842841
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
843842
ngx_close_file_n "\"%s\" failed",
844843
zmcf->dict_file->data);

0 commit comments

Comments
 (0)