1 /* Copyright (C) 2009 Trend Micro Inc.
4 * This program is a free software; you can redistribute it
5 * and/or modify it under the terms of the GNU General Public
6 * License (version 2) as published by the FSF - Free Software
15 #include "os_regex_internal.h"
18 /* Release all the memory created by the compilation/execution phases */
19 void OSRegex_FreePattern(OSRegex *reg)
21 /* Free the match data */
22 if (reg->match_data) {
23 pcre2_match_data_free(reg->match_data);
24 reg->match_data = NULL;
29 pcre2_code_free(reg->regex);
33 /* Free the patter, */
39 /* Free the sub strings */
40 if (reg->sub_strings) {
41 OSRegex_FreeSubStrings(reg);
42 free(reg->sub_strings);
43 reg->sub_strings = NULL;