From 1a45eaeb47ea6d8033ef0c16882cb023acb203c8 Mon Sep 17 00:00:00 2001 From: morriss Date: Sun, 18 Oct 2009 19:46:46 +0000 Subject: [PATCH] dcerpc_fragment_key_copy(): don't se_alloc() the key: - it contains pointers to a couple malloc()'d addresses - it is inserted in the fragment table (the contents of which are g_free()'d in free_all_fragments()) Instead, do like fragment_key_copy() and use a g_slice or g_chunk, depending on the glib version. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30599 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/reassemble.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/epan/reassemble.c b/epan/reassemble.c index f1ff411ccf..7645c524fb 100644 --- a/epan/reassemble.c +++ b/epan/reassemble.c @@ -53,6 +53,7 @@ typedef struct _dcerpc_fragment_key { #else static GMemChunk *fragment_key_chunk = NULL; static GMemChunk *fragment_data_chunk = NULL; +static GMemChunk *dcerpc_key_chunk = NULL; static int fragment_init_count = 200; #endif @@ -89,7 +90,12 @@ static void *fragment_key_copy(const void *k) static void *dcerpc_fragment_key_copy(const void *k) { const dcerpc_fragment_key* key = (const dcerpc_fragment_key*) k; - dcerpc_fragment_key *new_key = se_alloc(sizeof(dcerpc_fragment_key)); + +#if GLIB_CHECK_VERSION(2,10,0) + dcerpc_fragment_key *new_key = g_slice_new(dcerpc_fragment_key); +#else + dcerpc_fragment_key *new_key = g_mem_chunk_alloc(dcerpc_fragment_key_chunk); +#endif COPY_ADDRESS(&new_key->src, &key->src); COPY_ADDRESS(&new_key->dst, &key->dst); -- 2.34.1