[PATCH] Core: improved ngx_pstrdup() error handling

Tatsuhiko Kubo cubicdaiya at gmail.com
Fri Aug 1 11:12:05 UTC 2014


# HG changeset patch
# User Tatsuhiko Kubo <cubicdaiya at gmail.com>
# Date 1406891054 -32400
#      Fri Aug 01 20:04:14 2014 +0900
# Node ID 136ec9b0dcc48104d4f27aa2433cc78246153ef7
# Parent  428303916425d3b7eee77e7918df11bd85da2db1
Core: improved ngx_pstrdup() error handling.

diff -r 428303916425 -r 136ec9b0dcc4 src/core/ngx_conf_file.c
--- a/src/core/ngx_conf_file.c	Thu Jul 31 03:52:28 2014 -0700
+++ b/src/core/ngx_conf_file.c	Fri Aug 01 20:04:14 2014 +0900
@@ -781,6 +781,9 @@
 
         file.len = name.len++;
         file.data = ngx_pstrdup(cf->pool, &name);
+        if (file.data == NULL) {
+            return NGX_CONF_ERROR;
+        }
 
         ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
 



More information about the nginx-devel mailing list