Imported Upstream version 2.5.1
[ossec-hids.git] / src / os_regex / os_regex_free_substrings.c
1 /* $OSSEC, os_regex_free_substrings.c, v0.1, 2006/01/02, Daniel B. Cid$ */
2
3 /* Copyright (C) 2009 Trend Micro Inc.
4  * All right reserved.
5  *
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
9  * Foundation
10  */
11
12
13 #include <stdio.h>
14 #include <string.h>
15 #include <stdlib.h>
16
17 #include "os_regex.h"
18 #include "os_regex_internal.h"
19
20
21 /** int OSRegex_FreeSubStrings(OSRegex *reg) v0.1
22  * Release all the memory created to store the sub strings.
23  * Returns void.
24  */
25 void OSRegex_FreeSubStrings(OSRegex *reg)
26 {
27     int i = 0;
28
29     /* Freeing the sub strings */
30     if(reg->sub_strings)
31     {
32         while(reg->sub_strings[i])
33         {
34             free(reg->sub_strings[i]);
35             reg->sub_strings[i] = NULL;
36             i++;
37         }
38     }
39     return;
40 }
41
42
43 /* EOF */