From: Victor Julien Date: Mon, 18 Dec 2023 10:29:01 +0000 (+0100) Subject: detect/pcre: remove unused match member X-Git-Tag: suricata-8.0.0-beta1~1878 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2e9c258c47ed232499c93885b155c9a66644e50;p=thirdparty%2Fsuricata.git detect/pcre: remove unused match member pcre2_match_data is created per thread when needed. --- diff --git a/src/detect-parse.c b/src/detect-parse.c index bf46840458..c259fd36f9 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -2710,9 +2710,6 @@ void DetectParseFreeRegex(DetectParseRegex *r) if (r->context) { pcre2_match_context_free(r->context); } - if (r->match) { - pcre2_match_data_free(r->match); - } } void DetectParseFreeRegexes(void) @@ -2738,7 +2735,6 @@ void DetectParseRegexAddToFreeList(DetectParseRegex *detect_parse) FatalError("failed to alloc memory for pcre free list"); } r->regex = detect_parse->regex; - r->match = detect_parse->match; r->next = g_detect_parse_regex_list; g_detect_parse_regex_list = r; } @@ -2758,8 +2754,6 @@ bool DetectSetupParseRegexesOpts(const char *parse_str, DetectParseRegex *detect parse_str, en, errbuffer); return false; } - detect_parse->match = pcre2_match_data_create_from_pattern(detect_parse->regex, NULL); - DetectParseRegexAddToFreeList(detect_parse); return true; @@ -2785,7 +2779,6 @@ DetectParseRegex *DetectSetupPCRE2(const char *parse_str, int opts) SCFree(detect_parse); return NULL; } - detect_parse->match = pcre2_match_data_create_from_pattern(detect_parse->regex, NULL); detect_parse->next = g_detect_parse_regex_list; g_detect_parse_regex_list = detect_parse; diff --git a/src/detect-parse.h b/src/detect-parse.h index 9901801410..900771a3a9 100644 --- a/src/detect-parse.h +++ b/src/detect-parse.h @@ -62,7 +62,6 @@ enum { typedef struct DetectParseRegex { pcre2_code *regex; pcre2_match_context *context; - pcre2_match_data *match; struct DetectParseRegex *next; } DetectParseRegex; diff --git a/src/detect-pcre.c b/src/detect-pcre.c index 0c22e8d8ea..6d20dd08bb 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -678,7 +678,6 @@ static DetectPcreData *DetectPcreParse (DetectEngineCtx *de_ctx, SCLogError("pcre2 could not create match context"); goto error; } - pd->parse_regex.match = pcre2_match_data_create_from_pattern(pd->parse_regex.regex, NULL); if (apply_match_limit) { if (pcre_match_limit >= -1) {