Wireshark mailing list archives

Re: Question regarding emem -> wmem conversion


From: Evan Huus <eapache () gmail com>
Date: Fri, 13 Sep 2013 08:30:54 -0400

On 2013-09-13, at 7:55 AM, Dario Lombardo <dario.lombardo.ml () gmail com> wrote:

I'm trying to address se_alloc() calls. If I change this:

Index: packet-infiniband_sdp.c
===================================================================
--- packet-infiniband_sdp.c   (revision 52002)
+++ packet-infiniband_sdp.c   (working copy)
@@ -31,6 +31,7 @@
 #include <epan/packet.h>
 #include <epan/prefs.h>
 #include <epan/conversation.h>
+#include <epan/wmem/wmem.h>
 #include <stdlib.h>
 #include <errno.h>
 
@@ -529,8 +530,8 @@
         heur_dissector_add("infiniband.mad.cm.private", dissect_ib_sdp, proto_ib_sdp);
 
         /* allocate enough space in the addresses to store the largest address (a GID) */
-        manual_addr_data[0] = se_alloc(GID_SIZE);
-        manual_addr_data[1] = se_alloc(GID_SIZE);
+        manual_addr_data[0] = wmem_alloc(wmem_file_scope(), GID_SIZE);
+        manual_addr_data[1] = wmem_alloc(wmem_file_scope(), GID_SIZE);
 
         initialized = TRUE;
     }
@@ -567,4 +568,3 @@
 
     }
 }
-

tshark -v crashes. What is wrong with my patch?

Apparently there is no file in scope when that code is run. Depending on the necessary lifetime of the memory, it may 
make sense to replace it with epan scoped memory (the lifetime of the program, basically) or manually managed memory if 
the lifetime is something else.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: