From Graham Bloice:
authorjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 26 Jan 2007 17:12:00 +0000 (17:12 +0000)
committerjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 26 Jan 2007 17:12:00 +0000 (17:12 +0000)
In the Developers Guide, Section 9.3, Example 9.17. Decompressing data
packets for dissection

The code calls tvb_set_free_cb() for the newly created next_tvb.  This
is unnecessary as the call to tvb_set_child_real_data() adds next_tvb to
the chained list of tvb, thus ensuring that next_tvb is correctly
deleted.  In fact when I had the call in, Visual Studio kept breaking
deep down in ntdll.dll, probably because of a double free every time the
main tvb was deleted.

In README.developer, para 2..2.7 The example conversation code doesn't
assign the result of conversation_new() back into the conversation variable.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20569 f5534014-38df-0310-8fa8-9805f1628bb7

doc/README.developer
docbook/wsdg_src/WSDG_chapter_dissection.xml

index 6d603f968ee8c476971e5d60d0790e07fda08f76..d713f6b14dd357e9f2b2110fc5412679b2261fb9 100644 (file)
@@ -2809,7 +2809,7 @@ else {
 
     /* create the conversation with your data pointer  */
 
-    conversation_new(pinfo->fd->num,  &pinfo->src, &pinfo->dst, pinfo->ptype,
+    conversation = conversation_new(pinfo->fd->num,  &pinfo->src, &pinfo->dst, pinfo->ptype,
            pinfo->srcport, pinfo->destport, 0);
     conversation_add_proto_data(conversation, my_proto, (void *)data_ptr);
 }
index 6ccc3bbd58b0870a95fad2daf1eaa67f21e67744..69d229a0d00ff1bcac11c629147d7e7d4c32bf3d 100644 (file)
@@ -682,7 +682,6 @@ dissect_foo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
                next_tvb = tvb_new_real_data(decompressed_buffer, orig_size, orig_size);
                tvb_set_child_real_data_tvbuff(tvb, next_tvb);
                add_new_data_source(pinfo, next_tvb, "Decompressed Data");
-               tvb_set_free_cb(next_tvb, g_free);
        } else {
                next_tvb = tvb_new_subset(tvb, offset, -1, -1);
        }