Move resetting packet_info structure from dissect_packet() to epan_dissect_init()
authorJakub Zawadzki <darkjames-ws@darkjames.pl>
Sun, 20 Oct 2013 10:11:16 +0000 (10:11 -0000)
committerJakub Zawadzki <darkjames-ws@darkjames.pl>
Sun, 20 Oct 2013 10:11:16 +0000 (10:11 -0000)
It'd be actually good idea to seperate packet_info data (packet.c) from epan_dissect_t (epan.c),
but this rule is already violated.

Strict seperation could allow for example allow multiple dissection on the same epan_dissect_t
(I think it was idea behind it), but it's not working.

svn path=/trunk/; revision=52705

epan/epan.c
epan/packet.c

index 54c4ab5647945c1f2b5341dd39f350e76267cd4b..3fd514c6e5cfab6d101875f3edb013a543b80ae9 100644 (file)
@@ -220,7 +220,6 @@ epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_pr
        g_assert(edt);
 
        edt->session = session;
-       edt->pi.pool = wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE);
 
        if (create_proto_tree) {
                edt->tree = proto_tree_create_root(&edt->pi);
@@ -230,7 +229,8 @@ epan_dissect_init(epan_dissect_t *edt, epan_t *session, const gboolean create_pr
                edt->tree = NULL;
        }
 
-       edt->pi.dependent_frames = NULL;
+       memset(&edt->pi, 0, sizeof(edt->pi));
+       edt->pi.pool = wmem_allocator_new(WMEM_ALLOCATOR_SIMPLE);
 
        return edt;
 }
index d110eb637a6db8d90948116667781a386e5a5f1c..ade14b4403be89139e7920d51771976593b712d9 100644 (file)
@@ -404,14 +404,10 @@ void
 dissect_packet(epan_dissect_t *edt, struct wtap_pkthdr *phdr,
               tvbuff_t *tvb, frame_data *fd, column_info *cinfo)
 {
-       /* We have to preserve the pool pointer across the memzeroing */
-       wmem_allocator_t *tmp = edt->pi.pool;
-
        if (cinfo != NULL)
                col_init(cinfo, edt->session);
-       memset(&edt->pi, 0, sizeof(edt->pi));
        edt->pi.epan = edt->session;
-       edt->pi.pool = tmp;
+       /* edt->pi.pool created in epan_dissect_init() */
        edt->pi.current_proto = "<Missing Protocol Name>";
        edt->pi.cinfo = cinfo;
        edt->pi.fd    = fd;