X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=ossec-hids.git;a=blobdiff_plain;f=src%2Fos_regex%2Fos_regex_free_pattern.c;fp=src%2Fos_regex%2Fos_regex_free_pattern.c;h=fbc47700132c67507fc4cf745d7cbcb0dccaa765;hp=5dfee68eb6c13ffa63e4082c107ffbb7b2db2241;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hpb=927951d1c1ad45ba9e7325f07d996154a91c911b diff --git a/src/os_regex/os_regex_free_pattern.c b/src/os_regex/os_regex_free_pattern.c old mode 100755 new mode 100644 index 5dfee68..fbc4770 --- a/src/os_regex/os_regex_free_pattern.c +++ b/src/os_regex/os_regex_free_pattern.c @@ -1,5 +1,3 @@ -/* $OSSEC, os_regex_free_pattern.c, v0.1, 2006/01/02, Daniel B. Cid$ */ - /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. * @@ -9,7 +7,6 @@ * Foundation */ - #include #include #include @@ -18,63 +15,29 @@ #include "os_regex_internal.h" -/** int OSRegex_FreePattern(SRegex *reg) v0.1 - * Release all the memory created by the compilation/executation - * phases. - * Returns void. - */ +/* Release all the memory created by the compilation/execution phases */ void OSRegex_FreePattern(OSRegex *reg) { - int i = 0; - - /* Freeing the patterns */ - if(reg->patterns) - { - char **pattern = reg->patterns; - while(*pattern) - { - if(*pattern) - free(*pattern); - pattern++; - } - - free(reg->patterns); - reg->patterns = NULL; + /* Free the match data */ + if (reg->match_data) { + pcre2_match_data_free(reg->match_data); + reg->match_data = NULL; } - /* Freeing the flags */ - free(reg->flags); - reg->flags = NULL; - - /* Freeing the closure */ - if(reg->prts_closure) - { - i = 0; - while(reg->prts_closure[i]) - { - free(reg->prts_closure[i]); - i++; - } - free(reg->prts_closure); - reg->prts_closure = NULL; + /* Free the regex */ + if (reg->regex) { + pcre2_code_free(reg->regex); + reg->regex = NULL; } - /* Freeing the str */ - if(reg->prts_str) - { - i = 0; - while(reg->prts_str[i]) - { - free(reg->prts_str[i]); - i++; - } - free(reg->prts_str); - reg->prts_str = NULL; + /* Free the patter, */ + if (reg->pattern) { + free(reg->pattern); + reg->pattern = NULL; } - /* Freeing the sub strings */ - if(reg->sub_strings) - { + /* Free the sub strings */ + if (reg->sub_strings) { OSRegex_FreeSubStrings(reg); free(reg->sub_strings); reg->sub_strings = NULL; @@ -83,5 +46,3 @@ void OSRegex_FreePattern(OSRegex *reg) return; } - -/* EOF */