Wireshark-dev: [Wireshark-dev] [PATCH] fixup memory leak
From: Sebastien Tandel <[email protected]>
Date: Thu, 14 Dec 2006 02:34:57 +0100
Hi,


   here is patch for a memory leak in packet-k12.c which allocates a
hash table and may return without destroying it.


Regards,
Sebastien Tandel
Index: epan/dissectors/packet-k12.c
===================================================================
--- epan/dissectors/packet-k12.c	(révision 20131)
+++ epan/dissectors/packet-k12.c	(copie de travail)
@@ -136,7 +136,7 @@
 	FILE* fp;
 	gchar buffer[0x10000];
 	size_t len;
-	GHashTable* hash = g_hash_table_new(g_str_hash,g_str_equal);
+	GHashTable* hash;
 	gchar** curr;
 	gchar** lines = NULL;
 	guint i;
@@ -152,6 +152,8 @@
 		return NULL;
 	}
 
+	hash = g_hash_table_new(g_str_hash, g_str_equal);
+
 	if (len > 0) {
 
 		lines = g_strsplit(buffer,"\n",0);