[nginx] Use ngx_pcalloc() in ngx_conf_merge_path_value().

Valentin Bartenev vbart at nginx.com
Mon Sep 16 15:07:21 UTC 2013


details:   http://hg.nginx.org/nginx/rev/7d8770196436
branches:  
changeset: 5375:7d8770196436
user:      Valentin Bartenev <vbart at nginx.com>
date:      Mon Sep 16 18:49:10 2013 +0400
description:
Use ngx_pcalloc() in ngx_conf_merge_path_value().

It initializes the "data" pointer of ngx_path_t that will be checked after
subsequent changes.

diffstat:

 src/core/ngx_file.c |  6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diffs (23 lines):

diff -r ef3d094bb6d3 -r 7d8770196436 src/core/ngx_file.c
--- a/src/core/ngx_file.c	Mon Sep 16 18:33:39 2013 +0400
+++ b/src/core/ngx_file.c	Mon Sep 16 18:49:10 2013 +0400
@@ -402,7 +402,7 @@ ngx_conf_merge_path_value(ngx_conf_t *cf
         return NGX_CONF_OK;
     }
 
-    *path = ngx_palloc(cf->pool, sizeof(ngx_path_t));
+    *path = ngx_pcalloc(cf->pool, sizeof(ngx_path_t));
     if (*path == NULL) {
         return NGX_CONF_ERROR;
     }
@@ -421,10 +421,6 @@ ngx_conf_merge_path_value(ngx_conf_t *cf
                    + init->level[1] + (init->level[1] ? 1 : 0)
                    + init->level[2] + (init->level[2] ? 1 : 0);
 
-    (*path)->manager = NULL;
-    (*path)->loader = NULL;
-    (*path)->conf_file = NULL;
-
     if (ngx_add_path(cf, path) != NGX_OK) {
         return NGX_CONF_ERROR;
     }



More information about the nginx-devel mailing list