Skip to content

Commit

Permalink
fixed dangling pointer.
Browse files Browse the repository at this point in the history
  • Loading branch information
ifplusor committed Apr 7, 2020
1 parent 7f0259e commit a4da20f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cmake-build-*

.vs
.vscode
.VSCodeCounter
CMakeSettings.json

cmake-build/
Expand Down
2 changes: 1 addition & 1 deletion actrie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

__all__ = ['Matcher', 'Context', 'PrefixMatcher']

__version__ = '3.0.6'
__version__ = '3.0.7'
Empty file removed setup.cfg
Empty file.
8 changes: 7 additions & 1 deletion src/matcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ static void add_pattern_to_matcher(ptrn_t pattern, strlen_t extra, void* arg) {

static void free_expr_list(void* trie, void* node) {
list_t list = (list_t)node;
while (list != NULL) {
// NOTE: car of list is expr_t, and it is not aobj!!!
list->car = NULL;
list = list->cdr;
}
list = (list_t)node;
_release(list);
}

Expand Down Expand Up @@ -74,8 +80,8 @@ matcher_t matcher_construct_by_string(strlen_t string, bool all_as_plain, bool i

void matcher_destruct(matcher_t matcher) {
if (matcher != NULL) {
reglet_destruct(matcher->reglet);
dat_destruct(matcher->datrie, (dat_node_free_f)free_expr_list);
reglet_destruct(matcher->reglet);
matcher_free(matcher);
}
}
Expand Down

0 comments on commit a4da20f

Please sign in to comment.