diff options
author | aszlig <aszlig@nix.build> | 2019-04-18 08:13:41 +0200 |
---|---|---|
committer | aszlig <aszlig@nix.build> | 2019-04-18 09:40:13 +0200 |
commit | af5a3ce4740e78b667994ed444a72bec610b3ec8 (patch) | |
tree | a2ea7bb1b9523a9b32a59f93c89fbf1692f4ecc6 /pkgs/servers/http | |
parent | 1da8eec00fbe79301fcd5ce0b091405fc475fab0 (diff) | |
download | nixpkgs-af5a3ce4740e78b667994ed444a72bec610b3ec8.tar nixpkgs-af5a3ce4740e78b667994ed444a72bec610b3ec8.tar.gz nixpkgs-af5a3ce4740e78b667994ed444a72bec610b3ec8.tar.bz2 nixpkgs-af5a3ce4740e78b667994ed444a72bec610b3ec8.tar.lz nixpkgs-af5a3ce4740e78b667994ed444a72bec610b3ec8.tar.xz nixpkgs-af5a3ce4740e78b667994ed444a72bec610b3ec8.tar.zst nixpkgs-af5a3ce4740e78b667994ed444a72bec610b3ec8.zip |
nginx: Fix memleak in nix-etag patch
The original patch introduced a new "real" variable which gets populated (and allocated) via ngx_realpath(). It's properly freed in error conditions but it won't be freed if ngx_http_set_etag returns successfully. Adding another ngx_free() just before returning fixes that memory leak. I also fixed a small indentation issue along the way. Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'pkgs/servers/http')
-rw-r--r-- | pkgs/servers/http/nginx/nix-etag-1.15.4.patch | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pkgs/servers/http/nginx/nix-etag-1.15.4.patch b/pkgs/servers/http/nginx/nix-etag-1.15.4.patch index 4d8a6510cbf..1a8dcb4303a 100644 --- a/pkgs/servers/http/nginx/nix-etag-1.15.4.patch +++ b/pkgs/servers/http/nginx/nix-etag-1.15.4.patch @@ -19,7 +19,7 @@ index c57ec00c..b7992de2 100644 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); -@@ -1598,16 +1599,59 @@ ngx_http_set_etag(ngx_http_request_t *r) +@@ -1598,16 +1599,61 @@ ngx_http_set_etag(ngx_http_request_t *r) etag->hash = 1; ngx_str_set(&etag->key, "ETag"); @@ -44,7 +44,7 @@ index c57ec00c..b7992de2 100644 + && real[NIX_STORE_LEN] == '/' + && real[NIX_STORE_LEN + 1] != '\0') + { -+ ptr1 = real + NIX_STORE_LEN; ++ ptr1 = real + NIX_STORE_LEN; + *ptr1 = '"'; + + ptr2 = (u_char *) ngx_strchr(ptr1, '-'); @@ -82,6 +82,8 @@ index c57ec00c..b7992de2 100644 + r->headers_out.content_length_n) + - etag->value.data; + } ++ ++ ngx_free(real); r->headers_out.etag = etag; |