Skip to content

Commit

Permalink
Fixed potential leak of temp pool.
Browse files Browse the repository at this point in the history
In case ngx_hash_add_key() fails, need to goto failed instead of returning,
so that temp_pool will be destoryed.
  • Loading branch information
erankor committed Jun 15, 2020
1 parent 0a683fd commit 1bbc37d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/http/ngx_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1469,14 +1469,14 @@ ngx_http_server_names(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf,
NGX_HASH_WILDCARD_KEY);

if (rc == NGX_ERROR) {
return NGX_ERROR;
goto failed;
}

if (rc == NGX_DECLINED) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
"invalid server name or wildcard \"%V\" on %V",
&name[n].name, &addr->opt.addr_text);
return NGX_ERROR;
goto failed;
}

if (rc == NGX_BUSY) {
Expand Down

0 comments on commit 1bbc37d

Please sign in to comment.