diff --git a/src/engine/modules/regex.c b/src/engine/modules/regex.c index b6cbd3818..ddb1952b8 100644 --- a/src/engine/modules/regex.c +++ b/src/engine/modules/regex.c @@ -32,22 +32,24 @@ LIST *regex_transform( PARSE *parse, FRAME *frame ) /* Result is cached and intentionally never freed */ - regexp *re = regex_compile( pattern->string ); - - for(; l; l = l->next) { - if( regexec( re, l->string ) ) + regexp *re = regex_compile( pattern->string ); + + for(; l; l = l->next) { - if (re->startp[1]) + if( regexec( re, l->string ) ) { - string_append_range( buf, re->startp[1], re->endp[1] ); - result = list_new( result, newstr( buf->value ) ); - string_truncate( buf, 0 ); + if (re->startp[1]) + { + string_append_range( buf, re->startp[1], re->endp[1] ); + result = list_new( result, newstr( buf->value ) ); + string_truncate( buf, 0 ); + } } } + string_free( buf ); } - string_free( buf ); - + return result; } diff --git a/src/engine/native.c b/src/engine/native.c index 89310fbae..706c8a289 100644 --- a/src/engine/native.c +++ b/src/engine/native.c @@ -14,18 +14,21 @@ void declare_native_rule(char* module, char* rule, char** args, if (m->native_rules == 0) { m->native_rules = hashinit( sizeof( native_rule_t ), "native rules"); } - native_rule_t n, *np = &n; - n.name = rule; - if (args) + { - n.arguments = args_new(); - lol_build( n.arguments->data, args ); - } - else - { - n.arguments = 0; + native_rule_t n, *np = &n; + n.name = rule; + if (args) + { + n.arguments = args_new(); + lol_build( n.arguments->data, args ); + } + else + { + n.arguments = 0; + } + n.procedure = parse_make( f, P0, P0, P0, C0, C0, 0 ); + hashenter(m->native_rules, (HASHDATA**)&np); } - n.procedure = parse_make( f, P0, P0, P0, C0, C0, 0 ); - hashenter(m->native_rules, (HASHDATA**)&np); }