From 5f1185a6bf83f8ea2dabe025f7913553f1c22947 Mon Sep 17 00:00:00 2001 From: "K.Kosako" Date: Wed, 27 Mar 2019 15:07:00 +0900 Subject: [PATCH] add string_pool_end member into regex_t --- src/regcomp.c | 6 ++++-- src/regint.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/regcomp.c b/src/regcomp.c index f2f0f78..c33be15 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -371,7 +371,8 @@ ops_make_string_pool(regex_t* reg) } } - reg->string_pool = pool; + reg->string_pool = pool; + reg->string_pool_end = pool + size; return 0; } @@ -6219,7 +6220,7 @@ onig_free_body(regex_t* reg) ops_free(reg); if (IS_NOT_NULL(reg->string_pool)) { xfree(reg->string_pool); - reg->string_pool = 0; + reg->string_pool_end = reg->string_pool = 0; } if (IS_NOT_NULL(reg->exact)) xfree(reg->exact); if (IS_NOT_NULL(reg->repeat_range)) xfree(reg->repeat_range); @@ -6277,6 +6278,7 @@ onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end, reg->ops_used = 0; reg->string_pool = 0; + reg->string_pool_end = 0; reg->num_mem = 0; reg->num_repeat = 0; reg->num_null_check = 0; diff --git a/src/regint.h b/src/regint.h index 0c3bf60..56767e8 100644 --- a/src/regint.h +++ b/src/regint.h @@ -943,6 +943,7 @@ struct re_pattern_buffer { unsigned int ops_used; /* used space for ops */ unsigned int ops_alloc; /* allocated space for ops */ unsigned char* string_pool; + unsigned char* string_pool_end; int num_mem; /* used memory(...) num counted from 1 */ int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */ -- 2.40.0