# HG changeset patch
# User Roman Arutyunyan <arut@nginx.com>
# Date 1442836198 -10800
#      Mon Sep 21 14:49:58 2015 +0300
# Node ID a58e3a3304e0a15092291d216dc1346b808d83ce
# Parent  de3b5bc41b8623e6f3fd9f670e5a92fc1a84701e
Sub filter: fixed initialization in http{} level (ticket #791).

If sub_filter directive was only specified at http{} level, sub filter
internal data remained uninitialized.  That would lead to a crash in runtime.

diff -r de3b5bc41b86 -r a58e3a3304e0 src/http/modules/ngx_http_sub_filter_module.c
--- a/src/http/modules/ngx_http_sub_filter_module.c	Fri Sep 18 15:14:20 2015 +0300
+++ b/src/http/modules/ngx_http_sub_filter_module.c	Mon Sep 21 14:49:58 2015 +0300
@@ -853,8 +853,9 @@ ngx_http_sub_merge_conf(ngx_conf_t *cf, 
         conf->pairs = prev->pairs;
         conf->matches = prev->matches;
         conf->tables = prev->tables;
+    }
 
-    } else if (conf->dynamic == 0){
+    if (conf->pairs && conf->dynamic == 0 && conf->tables == NULL) {
         pairs = conf->pairs->elts;
         n = conf->pairs->nelts;
 
