Skip to content

Commit a1ec138

Browse files
bugfix: didn't free ngx_regex_match_context.
1 parent 47e8d8b commit a1ec138

15 files changed

+31
-3
lines changed

src/ngx_http_lua_regex.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,11 @@ ngx_http_lua_regex_cleanup(void *data)
501501

502502
if (ngx_regex_compile_context) {
503503
old_pool = ngx_http_lua_pcre_malloc_init(NULL);
504+
if (ngx_regex_match_context != NULL) {
505+
pcre2_match_context_free(ngx_regex_match_context);
506+
ngx_regex_match_context = NULL;
507+
}
508+
504509
pcre2_compile_context_free(ngx_regex_compile_context);
505510
ngx_regex_compile_context = NULL;
506511
ngx_http_lua_pcre_malloc_done(old_pool);

t/002-content.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,3 +1120,4 @@ If-Unmodified-Since: Wed, 01 Jan 2020 07:28:00 GMT
11201120
--- error_code: 412
11211121
--- no_error_log
11221122
unknown phase: 0
1123+
--- skip_eval: 2:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)

t/005-exit.t

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ GET /t
659659
--- response_body_like: 403 Forbidden
660660
--- no_error_log
661661
[error]
662+
--- skip_eval: 3:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)
662663
663664
664665
@@ -677,6 +678,7 @@ GET /t
677678
--- response_body
678679
--- no_error_log
679680
[error]
681+
--- skip_eval: 3:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)
680682
681683
682684
@@ -713,6 +715,7 @@ F(ngx_http_lua_header_filter_by_chunk).return {
713715
--- no_error_log
714716
[error]
715717
[alert]
718+
--- skip_eval: 4:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)
716719
717720
718721
@@ -730,6 +733,7 @@ GET /t
730733
--- response_body
731734
--- no_error_log
732735
[error]
736+
--- skip_eval: 3:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)
733737
734738
735739

t/016-resp-header.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,9 +2183,9 @@ foo: foo%0Axx:bar\r\nfoo: bar%0Dxxx:foo\r\n
21832183
hi
21842184
--- no_error_log
21852185
[alert]
2186-
--- error_log
2187-
my Content-Length: 8589934591
2188-
upstream prematurely closed connection while sending to client
2186+
--- error_log eval
2187+
[ "my Content-Length: 8589934591",
2188+
qr/upstream prematurely closed connection while sending to client|upstream prematurely closed connection while reading upstream/]
21892189
21902190
21912191

t/023-rewrite/req-socket.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,3 +540,4 @@ Expect: 100-Continue
540540
\breceived: hello\b.*?\breceived: worl\b
541541
--- no_error_log
542542
[error]
543+
--- skip_eval: 3:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)

t/025-codecache.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,7 @@ qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/,
855855
"decrementing the reference count for Lua VM: 2",
856856
"decrementing the reference count for Lua VM: 1",
857857
]
858+
--- skip_eval: 11:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)
858859

859860

860861

@@ -1120,6 +1121,7 @@ qq{lua tcp socket keepalive create connection pool for key "127.0.0.1:$ENV{TEST_
11201121
qr/\[alert\] \S+ lua_code_cache is off; this will hurt performance/,
11211122
qr/\blua tcp socket keepalive: free connection pool [0-9A-F]+ for "127.0.0.1:/,
11221123
]
1124+
--- skip_eval: 7:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)
11231125
11241126
11251127

t/041-header-filter.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ GET /t
847847
--- error_code: 302
848848
--- no_error_log
849849
[error]
850+
--- skip_eval: 3:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)
850851

851852

852853

t/056-flush.t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ hiya
4343
[error]
4444
--- error_log
4545
lua reuse free buf chain, but reallocate memory because 5 >= 0
46+
--- skip_eval: 4:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)
4647
4748
4849

t/058-tcp-socket.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,6 +3993,7 @@ hello world
39933993
[error]
39943994
--- error_log
39953995
lua tcp socket read any
3996+
--- skip_eval: 4:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} ne "")
39963997
39973998
39983999
@@ -4147,6 +4148,7 @@ hello world
41474148
[error]
41484149
--- error_log
41494150
lua tcp socket calling receiveany() method to read at most 128 bytes
4151+
--- skip_eval: 4:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} ne "")
41504152
41514153
41524154
@@ -4222,6 +4224,7 @@ orld
42224224
[error]
42234225
--- error_log
42244226
lua tcp socket calling receiveany() method to read at most 7 bytes
4227+
--- skip_eval: 4:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} ne "")
42254228
42264229
42274230

t/067-req-socket.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ Expect: 100-Continue
529529
\breceived: hello\b.*?\breceived: worl\b
530530
--- no_error_log
531531
[error]
532+
--- skip_eval: 3:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} =~ /w/)
532533
533534
534535
@@ -1176,6 +1177,7 @@ GET /t
11761177
received: received: abc
11771178
--- no_error_log
11781179
[error]
1180+
--- skip_eval: 3:defined($ENV{MOCKEAGAIN}) && ($ENV{MOCKEAGAIN} ne "")
11791181
11801182
11811183

0 commit comments

Comments
 (0)