Browse code

libclamav: cli_bm_free: free b-m nodes

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@710 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/07/31 02:16:08
Showing 3 changed files
... ...
@@ -63,6 +63,7 @@ Code patches submitted by (in alphabetical order):
63 63
 Kamil Andrusz <wizz*mniam.net>
64 64
 Patrick Bihan-Faou <patrick*mindstep.com>
65 65
 Martin Blapp <mb*imp.ch>
66
+Igor Brezac <igor*ipass.net>
66 67
 Len Budney <lbudney*pobox.com>
67 68
 Andrey Cherezov <andrey*cherezov.koenig.su>
68 69
 Alex Cherney <alex*cher.id.au>
... ...
@@ -1,3 +1,8 @@
1
+Fri Jul 30 19:10:44 CEST 2004 (tk)
2
+----------------------------------
3
+  * libclamav: cli_bm_free: free b-m nodes (patch by Igor Brezac
4
+	       <igor*ipass.net>)
5
+
1 6
 Fri Jul 30 19:02:42 CEST 2004 (tk)
2 7
 ----------------------------------
3 8
   * libclamav: fix (small) memory leaks
... ...
@@ -92,11 +92,28 @@ int cli_bm_init(struct cl_node *root)
92 92
 
93 93
 void cli_bm_free(struct cl_node *root)
94 94
 {
95
+	struct cli_bm_patt *b1, *b2;
96
+	int i;
97
+
98
+
95 99
     if(root->bm_shift)
96 100
 	free(root->bm_shift);
97 101
 
98
-    if(root->bm_suffix)
102
+    if(root->bm_suffix) {
103
+	for(i = 0; i < 65536; i++) {
104
+	    b1 = root->bm_suffix[i];
105
+	    while(b1) {
106
+		b2 = b1;
107
+		b1 = b1->next;
108
+		if(b2->virname)
109
+		    free(b2->virname);
110
+		if(b2->pattern)
111
+		    free(b2->pattern);
112
+		free(b2);
113
+	    }
114
+	}
99 115
 	free(root->bm_suffix);
116
+    }
100 117
 }
101 118
 
102 119
 int cli_bm_scanbuff(const char *buffer, unsigned int length, const char **virname, const struct cl_node *root)