Ethereal-dev: [Ethereal-dev] Type correction in proto.c [PATCH]

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Wed, 21 Dec 2005 16:35:29 +0100 (CET)
Hi list,

While looking into bug 239 I found a type mismatch in proto.c. Even
though tree_is_expanded is defined as a (gboolean *) the memory
allocation is carried out using sizeof (gint *). The attached patch fixes
this.

Thanx,
Jaap
Index: proto.c
===================================================================
--- proto.c	(revision 16868)
+++ proto.c	(working copy)
@@ -344,8 +344,8 @@
 
 	/* We've assigned all the subtree type values; allocate the array
 	   for them, and zero it out. */
-	tree_is_expanded = g_malloc(num_tree_types*sizeof (gint *));
-	memset(tree_is_expanded, 0, num_tree_types*sizeof (gint *));
+	tree_is_expanded = g_malloc(num_tree_types*sizeof (gboolean));
+	memset(tree_is_expanded, 0, num_tree_types*sizeof (gboolean));
 }
 
 /* String comparison func for dfilter_token GTree */
@@ -3313,9 +3313,9 @@
 	if (tree_is_expanded != NULL) {
 		tree_is_expanded =
 		    g_realloc(tree_is_expanded,
-		        (num_tree_types+num_indices)*sizeof (gint *));
+		        (num_tree_types+num_indices)*sizeof (gboolean));
 		memset(tree_is_expanded + num_tree_types, 0,
-		    num_indices*sizeof (gint *));
+		    num_indices*sizeof (gboolean));
 	}
 
 	/*