ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] [PATCH] fixup memory leak

From: Sebastien Tandel <sebastien@xxxxxxxxx>
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);