aboutsummaryrefslogtreecommitdiff
path: root/treexpr.c
diff options
context:
space:
mode:
Diffstat (limited to 'treexpr.c')
-rw-r--r--treexpr.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/treexpr.c b/treexpr.c
index eb68f2e..3b6a836 100644
--- a/treexpr.c
+++ b/treexpr.c
@@ -1143,3 +1143,21 @@ struct match *document_process( struct machine *m, xmlDocPtr doc )
{
return node_recurse( m, doc->children->next, NULL );
}
+
+// free matches returned by document_process
+void free_matches( struct match *z )
+{
+ struct match *nextz;
+ struct regex_match *nextre;
+
+ for( ; z != NULL; z = nextz )
+ {
+ nextz = z->next;
+ for( ; z->re != NULL; z->re = nextre )
+ {
+ nextre = z->re->next;
+ free( z->re );
+ }
+ free( z );
+ }
+}