[PATCH 1 of 2] clear err when ngx_regex_compile has allocation failure

Markus Linnala Markus.Linnala at cybercom.com
Sun Aug 17 20:00:29 UTC 2014


# HG changeset patch
# User Markus Linnala <Markus.Linnala at cybercom.com>
# Date 1408303316 -10800
#      Sun Aug 17 22:21:56 2014 +0300
# Node ID d350d288cffef0e6395ae1f412842c3b55bc8d42
# Parent  0719145489f842b14765506f8856798c2203e3cc
clear err when ngx_regex_compile has allocation failure

diff -r 0719145489f8 -r d350d288cffe src/core/ngx_regex.c
--- a/src/core/ngx_regex.c	Sun Aug 17 21:59:38 2014 +0300
+++ b/src/core/ngx_regex.c	Sun Aug 17 22:21:56 2014 +0300
@@ -149,6 +149,7 @@
 
     rc->regex = ngx_pcalloc(rc->pool, sizeof(ngx_regex_t));
     if (rc->regex == NULL) {
+        rc->err.len = 0;
         return NGX_ERROR;
     }
 
@@ -159,6 +160,7 @@
     if (ngx_pcre_studies != NULL) {
         elt = ngx_list_push(ngx_pcre_studies);
         if (elt == NULL) {
+            rc->err.len = 0;
             return NGX_ERROR;
         }
 



More information about the nginx-devel mailing list