Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4648 - trunk/src/http/modules

Anonymous User
May 28, 2012 09:18AM
Author: ru
Date: 2012-05-28 13:17:48 +0000 (Mon, 28 May 2012)
New Revision: 4648
URL: http://trac.nginx.org/nginx/changeset/4648/nginx

Log:
Fixed memory leak if $geoip_org variable was used.

Patch by Denis F. Latypoff (slightly modified).


Modified:
trunk/src/http/modules/ngx_http_geoip_module.c

Modified: trunk/src/http/modules/ngx_http_geoip_module.c
===================================================================
--- trunk/src/http/modules/ngx_http_geoip_module.c 2012-05-24 07:35:12 UTC (rev 4647)
+++ trunk/src/http/modules/ngx_http_geoip_module.c 2012-05-28 13:17:48 UTC (rev 4648)
@@ -291,6 +291,7 @@
ngx_http_geoip_variable_handler_pt handler =
(ngx_http_geoip_variable_handler_pt) data;

+ size_t len;
const char *val;
ngx_http_geoip_conf_t *gcf;

@@ -306,12 +307,22 @@
goto not_found;
}

- v->len = ngx_strlen(val);
+ len = ngx_strlen(val);
+ v->data = ngx_pnalloc(r->pool, len);
+ if (v->data == NULL) {
+ ngx_free(val);
+ return NGX_ERROR;
+ }
+
+ ngx_memcpy(v->data, val, len);
+
+ v->len = len;
v->valid = 1;
v->no_cacheable = 0;
v->not_found = 0;
- v->data = (u_char *) val;

+ ngx_free(val);
+
return NGX_OK;

not_found:

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4648 - trunk/src/http/modules

Anonymous User 1090 May 28, 2012 09:18AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 182
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready