mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
fixed 3 leaks in creating pattern values
This commit is contained in:
parent
610d1ae407
commit
2fa1ea77e4
4 changed files with 49 additions and 5 deletions
20
src/RE.cc
20
src/RE.cc
|
@ -19,6 +19,7 @@ int case_insensitive = 0;
|
|||
|
||||
extern int RE_parse(void);
|
||||
extern void RE_set_input(const char* str);
|
||||
extern void RE_done_with_scan();
|
||||
|
||||
Specific_RE_Matcher::Specific_RE_Matcher(match_type arg_mt, int arg_multiline)
|
||||
: equiv_class(NUM_SYM)
|
||||
|
@ -108,9 +109,15 @@ int Specific_RE_Matcher::Compile(int lazy)
|
|||
|
||||
rem = this;
|
||||
RE_set_input(pattern_text);
|
||||
if ( RE_parse() )
|
||||
|
||||
int parse_status = RE_parse();
|
||||
RE_done_with_scan();
|
||||
|
||||
if ( parse_status )
|
||||
{
|
||||
reporter->Error("error compiling pattern /%s/", pattern_text);
|
||||
Unref(nfa);
|
||||
nfa = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -139,9 +146,18 @@ int Specific_RE_Matcher::CompileSet(const string_list& set, const int_list& idx)
|
|||
loop_over_list(set, i)
|
||||
{
|
||||
RE_set_input(set[i]);
|
||||
if ( RE_parse() )
|
||||
int parse_status = RE_parse();
|
||||
RE_done_with_scan();
|
||||
|
||||
if ( parse_status )
|
||||
{
|
||||
reporter->Error("error compiling pattern /%s/", set[i]);
|
||||
|
||||
if ( set_nfa != nfa )
|
||||
Unref(set_nfa);
|
||||
Unref(nfa);
|
||||
nfa = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue