Fix a couple of memory leaks.
svn path=/trunk/; revision=438
This commit is contained in:
parent
5161130b4b
commit
41a8a32b7b
3
file.c
3
file.c
|
@ -1,7 +1,7 @@
|
|||
/* file.c
|
||||
* File I/O routines
|
||||
*
|
||||
* $Id: file.c,v 1.53 1999/08/02 02:04:25 guy Exp $
|
||||
* $Id: file.c,v 1.54 1999/08/04 23:43:42 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -431,6 +431,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf, const u_char *buf
|
|||
protocol_tree = proto_tree_create_root();
|
||||
dissect_packet(buf, fdata, protocol_tree);
|
||||
fdata->passed_dfilter = dfilter_apply(cf->dfcode, protocol_tree, cf->pd);
|
||||
proto_tree_free(protocol_tree);
|
||||
}
|
||||
else {
|
||||
dissect_packet(buf, fdata, NULL);
|
||||
|
|
22
proto.c
22
proto.c
|
@ -1,7 +1,7 @@
|
|||
/* proto.c
|
||||
* Routines for protocol tree
|
||||
*
|
||||
* $Id: proto.c,v 1.10 1999/08/03 14:59:16 gram Exp $
|
||||
* $Id: proto.c,v 1.11 1999/08/04 23:43:42 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -69,7 +69,7 @@
|
|||
#define WITH_SNMP_CMU 1
|
||||
#endif
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
proto_tree_free_node(GNode *node, gpointer data);
|
||||
|
||||
static struct header_field_info*
|
||||
|
@ -249,18 +249,22 @@ void
|
|||
proto_tree_free(proto_tree *tree)
|
||||
{
|
||||
g_node_traverse((GNode*)tree, G_IN_ORDER, G_TRAVERSE_ALL, -1,
|
||||
(GNodeTraverseFunc)proto_tree_free_node, NULL);
|
||||
proto_tree_free_node, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
proto_tree_free_node(GNode *node, gpointer data)
|
||||
{
|
||||
field_info *fi = (field_info*) (node->data);
|
||||
if (fi->representation)
|
||||
g_mem_chunk_free(gmc_item_labels, fi->representation);
|
||||
if (fi->hfinfo->type == FT_STRING)
|
||||
g_free(fi->value.string);
|
||||
g_mem_chunk_free(gmc_field_info, fi);
|
||||
|
||||
if (fi != NULL) {
|
||||
if (fi->representation)
|
||||
g_mem_chunk_free(gmc_item_labels, fi->representation);
|
||||
if (fi->hfinfo->type == FT_STRING)
|
||||
g_free(fi->value.string);
|
||||
g_mem_chunk_free(gmc_field_info, fi);
|
||||
}
|
||||
return FALSE; /* FALSE = do not end traversal of GNode tree */
|
||||
}
|
||||
|
||||
/* Finds a record in the hf_info_records array. */
|
||||
|
|
Loading…
Reference in New Issue