diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2015-08-11 14:08:08 +0200 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2015-08-11 12:09:07 +0000 |
commit | ecc4f756bdb6175cc0b3b11af2f90884db1c602c (patch) | |
tree | 99d8ca48a72752e1257d4b8b321f41d1767ee020 /epan/wslua/wslua_proto_expert.c | |
parent | 70d06deb2e31bd605e672200a7755764febe94ae (diff) |
Added Reload Lua plugins.
This is initial support for reloading Lua plugins without
restarting the application.
Still todo:
- Deregister FileHandlers
- Support deregister ProtoField with existing abbrev (same_name_hfinfo)
- Add a progress dialog when reloading many plugins
- Search for memory leakages in wslua functions
Change-Id: I48870d8741251705ca15ffe1068613fcb0cb18c1
Reviewed-on: https://code.wireshark.org/review/5028
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/wslua/wslua_proto_expert.c')
-rw-r--r-- | epan/wslua/wslua_proto_expert.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/epan/wslua/wslua_proto_expert.c b/epan/wslua/wslua_proto_expert.c index f1a36c13e3..8a8079152c 100644 --- a/epan/wslua/wslua_proto_expert.c +++ b/epan/wslua/wslua_proto_expert.c @@ -99,17 +99,11 @@ WSLUA_METAMETHOD ProtoExpert__tostring(lua_State* L) { static int ProtoExpert__gc(lua_State* L) { ProtoExpert pe = toProtoExpert(L,1); - /* - * A garbage collector for ProtoExpert makes little sense. - * Even if this cannot be used anymore because it has gone out of scope, - * we can destroy the ProtoExpert only if it is not part of a registered Proto, - * if it actually belongs to one we need to preserve it as it is pointed by - * a expert code causing a crash or memory corruption. - */ - - if (pe) { - luaL_argerror(L,1,"BUG: ProtoExpert_gc called for something not ProtoExpert"); - /* g_assert() ?? */ + if (pe->ids.hf == -2) { + /* Only free unregistered and deregistered ProtoExpert */ + g_free((gchar *)pe->abbrev); + g_free((gchar *)pe->text); + g_free(pe); } return 0; |