Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Question regarding emem -> wmem conversion

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Thu, 12 Sep 2013 17:12:52 +0200
I just looked at packet-tacacs.c. The conversion looked straight forward,
the em_alloc was easy to convert. Then I noticed calls to ep_address_to_str,
which is done in epan/ep_address_to_str.c
Is it OK to leave that and only convert the other strings, i.e. is it OK
if some of the memory is handled by emem and some by wmem?

Thanks
    Jörg


Index: dissectors/packet-tacacs.c
===================================================================
--- dissectors/packet-tacacs.c	(revision 51969)
+++ dissectors/packet-tacacs.c	(working copy)
@@ -63,7 +63,7 @@
 
 #include <epan/packet.h>
 #include <epan/prefs.h>
-#include <epan/emem.h>
+#include <epan/wmem/wmem.h>
 #include <epan/expert.h>
 #include "packet-tacacs.h"
 
@@ -1287,14 +1287,14 @@
 	int i,j;
 	size_t md5_len;
 	md5_byte_t *md5_buff;
-	md5_byte_t hash[MD5_LEN];       				/* the md5 hash */
+	md5_byte_t hash[MD5_LEN];				/* the md5 hash */
 	md5_byte_t *mdp;
 	md5_state_t mdcontext;
 
 	md5_len = 4 /* sizeof(session_id) */ + strlen(key)
 			+ sizeof(version) + sizeof(seq_no);
 
-	md5_buff = (md5_byte_t*)ep_alloc(md5_len+MD5_LEN);
+	md5_buff = (md5_byte_t*)wmem_alloc(wmem_packet_scope(), md5_len+MD5_LEN);
 
 
 	mdp = md5_buff;
-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.