1 /* $OSSEC, os_regex_free_pattern.c, v0.1, 2006/01/02, Daniel B. Cid$ */
3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 2) as published by the FSF - Free Software
18 #include "os_regex_internal.h"
21 /** int OSRegex_FreePattern(SRegex *reg) v0.1
22 * Release all the memory created by the compilation/executation
26 void OSRegex_FreePattern(OSRegex *reg)
30 /* Freeing the patterns */
33 char **pattern = reg->patterns;
45 /* Freeing the flags */
49 /* Freeing the closure */
53 while(reg->prts_closure[i])
55 free(reg->prts_closure[i]);
58 free(reg->prts_closure);
59 reg->prts_closure = NULL;
66 while(reg->prts_str[i])
68 free(reg->prts_str[i]);
75 /* Freeing the sub strings */
78 OSRegex_FreeSubStrings(reg);
79 free(reg->sub_strings);
80 reg->sub_strings = NULL;