aboutsummaryrefslogtreecommitdiffstats
path: root/proto.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>1999-08-26 06:20:50 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>1999-08-26 06:20:50 +0000
commitae356ef145c26c64b1fd5594d8159376c963e6a0 (patch)
treeb71f0856d81f4c8f314808f66661978c04532141 /proto.c
parent11b9a6e949183ec9601175c9d6e76408ccc685be (diff)
The dfilter yacc grammar now keeps track of every GNode that it allocates.
After a bad parse, instead of leaking this memory, the memory used for those GNodes is now freed. Added some memory-freeing "cleanup" routines for the dfilter and proto_tree modules, which are called right before ethereal exits. Maybe once we get a complete set of cleanup routines, we'll be able to better check if memory is leaking. svn path=/trunk/; revision=582
Diffstat (limited to 'proto.c')
-rw-r--r--proto.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/proto.c b/proto.c
index d185bf3943..319c428d9a 100644
--- a/proto.c
+++ b/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.16 1999/08/20 06:55:06 guy Exp $
+ * $Id: proto.c,v 1.17 1999/08/26 06:20:50 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -167,7 +167,7 @@ proto_init(void)
if (gmc_item_labels)
g_mem_chunk_destroy(gmc_item_labels);
if (gpa_hfinfo)
- g_ptr_array_free(gpa_hfinfo, FALSE); /* ever needs to be TRUE? */
+ g_ptr_array_free(gpa_hfinfo, FALSE);
gmc_hfinfo = g_mem_chunk_new("gmc_hfinfo",
sizeof(struct header_field_info), 50 * sizeof(struct
@@ -246,6 +246,19 @@ proto_init(void)
/* vals[] */ NULL );
}
+void
+proto_cleanup(void)
+{
+ if (gmc_hfinfo)
+ g_mem_chunk_destroy(gmc_hfinfo);
+ if (gmc_field_info)
+ g_mem_chunk_destroy(gmc_field_info);
+ if (gmc_item_labels)
+ g_mem_chunk_destroy(gmc_item_labels);
+ if (gpa_hfinfo)
+ g_ptr_array_free(gpa_hfinfo, FALSE);
+}
+
/* frees the resources that the dissection a proto_tree uses */
void
proto_tree_free(proto_tree *tree)