From a2f9787784ce322dcd49a4985626f8a9e276a71e Mon Sep 17 00:00:00 2001 From: Tomasz Kojm Date: Thu, 6 Dec 2007 15:24:03 +0000 Subject: [PATCH] fix handling of bfs_last (bb#713) git-svn: trunk@3381 --- ChangeLog | 4 ++++ libclamav/matcher-ac.c | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9443d83c..e4532eff8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Dec 6 15:39:11 CET 2007 (tk) +--------------------------------- + * libclamav/matcher-ac.c: fix handling of bfs_last (bb#713) + Thu Dec 6 15:29:00 CET 2007 (tk) --------------------------------- * libclamav/others.c: bump f-level diff --git a/libclamav/matcher-ac.c b/libclamav/matcher-ac.c index 52f93924d..6b8a63f0a 100644 --- a/libclamav/matcher-ac.c +++ b/libclamav/matcher-ac.c @@ -204,7 +204,7 @@ static int bfs_enqueue(struct bfs_list **bfs, struct bfs_list **last, struct cli return CL_SUCCESS; } -static struct cli_ac_node *bfs_dequeue(struct bfs_list **bfs) +static struct cli_ac_node *bfs_dequeue(struct bfs_list **bfs, struct bfs_list **last) { struct bfs_list *lpt; struct cli_ac_node *pt; @@ -215,6 +215,8 @@ static struct cli_ac_node *bfs_dequeue(struct bfs_list **bfs) } else { *bfs = (*bfs)->next; pt = lpt->node; + if(lpt == *last) + *last = NULL; free(lpt); return pt; } @@ -239,7 +241,7 @@ static int ac_maketrans(struct cli_matcher *root) } } - while((node = bfs_dequeue(&bfs))) { + while((node = bfs_dequeue(&bfs, &bfs_last))) { if(node->leaf) continue;