X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=src%2Fos_regex%2Fos_match_free_pattern.c;h=2a2ceadc8722eb35e1c2ddc9ed1bc7e111661052;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hp=7131f08fafa717149555c5618b64173b91cfdd71;hpb=301048b51990573e58a30dc4a5bb4ec285cad554;p=ossec-hids.git diff --git a/src/os_regex/os_match_free_pattern.c b/src/os_regex/os_match_free_pattern.c old mode 100755 new mode 100644 index 7131f08..2a2cead --- a/src/os_regex/os_match_free_pattern.c +++ b/src/os_regex/os_match_free_pattern.c @@ -1,5 +1,3 @@ -/* $OSSEC, os_match_free_pattern.c, v0.1, 2006/04/18, Daniel B. Cid$ */ - /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. * @@ -9,7 +7,6 @@ * Foundation */ - #include #include #include @@ -18,35 +15,27 @@ #include "os_regex_internal.h" -/** int OSMatch_FreePattern(OSMatch *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 OSMatch_FreePattern(OSMatch *reg) { - /* Freeing the patterns */ - if(reg->patterns) - { - char **pattern = reg->patterns; - while(*pattern) - { - if(*pattern) - free(*pattern); - pattern++; - } - - free(reg->patterns); - free(reg->size); - free(reg->match_fp); - - reg->patterns = NULL; - reg->size = NULL; - reg->match_fp = NULL; + /* Free the match data */ + if (reg->match_data) { + pcre2_match_data_free(reg->match_data); + reg->match_data = NULL; + } + + /* Free the regex */ + if (reg->regex) { + pcre2_code_free(reg->regex); + reg->regex = NULL; + } + + /* Free the patter, */ + if (reg->pattern) { + free(reg->pattern); + reg->pattern = NULL; } return; } - -/* EOF */