Wireshark-bugs: [Wireshark-bugs] [Bug 9296] Wireshark lua dissector unable to load for media_typ

Date: Mon, 21 Oct 2013 16:29:12 +0000

Comment # 5 on bug 9296 from
(In reply to comment #2)
> Lua appears to be the only dissector that calls dissector_add_string
> with a non-literal string.

This is the messy part.

> Would "capture scope" memory work?

Sort of. It technically wouldn't leak, and this bug would be fixed, but code
like:

while (true) {
   tbl:add
   tbl:delete
}

(or whatever the Lua equivalent is), while admittedly unusual, would increase
memory usage on every iteration, which it probably shouldn't.

The simplest fix, I think, is to have dissector_add_string do a g_strdup of the
key, and subsequently free it either in dissector_delete_string or when the
table is destroyed at the end of the program (possibly by specifying a key
destructor function to g_hash_table_new_full). The annoying part is that this
wastes a little memory for the 99.9% of strings that are static on the stack,
but I can't think of anything else off the top of my head.

Other ideas are welcome :)


You are receiving this mail because:
  • You are watching all bug changes.