mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
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>
This commit is contained in:
parent
1da8eec00f
commit
af5a3ce474
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user