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

Ethereal-dev: [Ethereal-dev] EMEM tvb_get_xxx and further directions

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: ronnie sahlberg <ronniesahlberg@xxxxxxxxx>
Date: Sat, 23 Jul 2005 18:52:06 -0400
List

There are only some 157 uses of tvb_get_string() and tvb_get_stringz()
used by dissectors.
They currently return g_malloced memory and a quick glance at their
use is that most of them virtually immediately g_free() that same
memory after doing a proto_tree_add_xxx or similar processing of them.

I also saw some uses that obviously leak memory since g_free was never
called, such as in packet-atalk.c .


For this i think we should change the semantics for tvb_get_string[z]
slightly and make it into
tvb_get_string[z]_ep    for allocations with packet lifetime and
tvb_get_string[z]_ec    for allocations with capture file lifetime.


Opinions?   maybe better names should be used?