Browse code

fix memory leak

git-svn: trunk@3986

Török Edvin authored on 2008/07/25 04:21:53
Showing 2 changed files
... ...
@@ -513,6 +513,9 @@ void regex_list_done(struct regex_matcher* matcher)
513 513
 			for(i=0;i<matcher->suffix_cnt;i++) {
514 514
 				struct regex_list *r = matcher->suffix_regexes[i];
515 515
 				while(r) {
516
+#ifdef CL_DEBUG
517
+					free(r->pattern);
518
+#endif
516 519
 					cli_regfree(&r->preg);
517 520
 					r = r->nxt;
518 521
 				}
... ...
@@ -441,6 +441,7 @@ int cli_regex2suffix(const char *pattern, struct regex_list *regex, suffix_callb
441 441
 	n->parent = &root_node;
442 442
 
443 443
 	rc = build_suffixtree_descend(n, &buf, cb, cbdata, regex);
444
+	free(buf.data);
444 445
 	destroy_tree(n);
445 446
 	return rc;
446 447
 }