From Graham Bloice:
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. svn path=/trunk/; revision=20569
This commit is contained in:
parent
f8be165898
commit
e4e739a5ca
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue