]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7383 #resolve
authorJun Wang <wj1918@hotmail.com>
Mon, 23 Mar 2015 02:27:08 +0000 (02:27 +0000)
committerJun Wang <wj1918@hotmail.com>
Mon, 23 Mar 2015 02:27:08 +0000 (02:27 +0000)
libs/spandsp/src/make_at_dictionary.c

index 6259207368e5858994bf5b954af73277e696f170..a34dd6f3a3fe09fc592994f7ef0b7460424ddb6c 100644 (file)
@@ -605,6 +605,33 @@ static void dump_trie(void)
 }
 /*- End of function --------------------------------------------------------*/
 
+
+static void trie_recursive_free(trie_node_t *t)
+{
+       int i;
+       if (t)
+       {
+               if (t->first <= t->last)
+               {
+                       for (i = t->first;  i <= t->last;  i++)
+                               trie_recursive_free(t->child_list[i]);
+               }
+               free(t);
+       }
+}
+/*- End of function --------------------------------------------------------*/
+
+static void trie_free(trie_t *s)
+{
+       if(s)
+       {
+               if(s->root)
+                       trie_recursive_free(s->root);
+               free(s);
+       }
+}
+/*- End of function --------------------------------------------------------*/
+
 int main(int argc, char *argv[])
 {
     trie_t *s;
@@ -627,6 +654,8 @@ int main(int argc, char *argv[])
     trie_recursive_build_packed_trie(s->root);
 
     dump_trie();
+     
+    trie_free(s);
 
     return 0;
 }