[nginx] svn commit: r4785 - trunk/src/core
mdounin at mdounin.ru
mdounin at mdounin.ru
Mon Aug 6 10:48:09 UTC 2012
Author: mdounin
Date: 2012-08-06 10:48:09 +0000 (Mon, 06 Aug 2012)
New Revision: 4785
URL: http://trac.nginx.org/nginx/changeset/4785/nginx
Log:
Resolver: fixed possible memory leak in ngx_resolver_create().
Found by Coverity.
Modified:
trunk/src/core/ngx_resolver.c
Modified: trunk/src/core/ngx_resolver.c
===================================================================
--- trunk/src/core/ngx_resolver.c 2012-08-03 12:52:32 UTC (rev 4784)
+++ trunk/src/core/ngx_resolver.c 2012-08-06 10:48:09 UTC (rev 4785)
@@ -113,15 +113,6 @@
return NULL;
}
- if (n) {
- if (ngx_array_init(&r->udp_connections, cf->pool, n,
- sizeof(ngx_udp_connection_t))
- != NGX_OK)
- {
- return NULL;
- }
- }
-
cln->data = r;
r->event = ngx_calloc(sizeof(ngx_event_t), cf->log);
@@ -153,6 +144,15 @@
r->log = &cf->cycle->new_log;
r->log_level = NGX_LOG_ERR;
+ if (n) {
+ if (ngx_array_init(&r->udp_connections, cf->pool, n,
+ sizeof(ngx_udp_connection_t))
+ != NGX_OK)
+ {
+ return NULL;
+ }
+ }
+
for (i = 0; i < n; i++) {
if (ngx_strncmp(names[i].data, "valid=", 6) == 0) {
s.len = names[i].len - 6;
More information about the nginx-devel
mailing list