On Oct 21, 2016, at 9:57 AM, Thomas Wiens <th.wi...@gmx.de> wrote: > This happens only when calling val_to_str inside the callback function. > When outside, then all is Ok (getting formatted result string on failure). > When I'm calling try_val_to_str_idx with a non existing value, then I > get -1 as index and NULL as result as expected, so I guess the problem is: > > wmem_strdup_printf(wmem_packet_scope(), fmt, val); > > Is there a limitation when I'm using format callbacks,
Yes. You're limited to using wmem scopes that are active even if you're *not* in the middle of dissecting a packet; the callback is called when the result of a dissection is being displayed or used for a custom column, and that's not in the middle of dissecting a packet. Unfortunately, I don't think there's a scope for this, so you'd either have to use NULL as the scope and explicitly free the string when you're done with it, or use try_val_to_str() and deal with a NULL return (nothing matches) yourself. ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@wireshark.org> Archives: https://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe