diff --git a/plugins/lua/lua_tree.c b/plugins/lua/lua_tree.c index 36a403e0c5..f6fa3474a1 100644 --- a/plugins/lua/lua_tree.c +++ b/plugins/lua/lua_tree.c @@ -38,6 +38,11 @@ static GPtrArray* outstanding_stuff = NULL; #define PUSH_PROTOITEM(L,i) g_ptr_array_add(outstanding_stuff,pushProtoItem(L,i)) #define PUSH_PROTOTREE(L,t) g_ptr_array_add(outstanding_stuff,pushProtoTree(L,t)) +void push_ProtoTree(lua_State*L, ProtoTree t) { + void** p = (void**)pushProtoTree(L,t); + g_ptr_array_add(outstanding_stuff,p); +} + void clear_outstanding_trees(void) { while (outstanding_stuff->len) { void** p = (void**)g_ptr_array_remove_index_fast(outstanding_stuff,0); diff --git a/plugins/lua/lua_tvb.c b/plugins/lua/lua_tvb.c index e96129bda4..dab2468119 100644 --- a/plugins/lua/lua_tvb.c +++ b/plugins/lua/lua_tvb.c @@ -302,6 +302,11 @@ void clear_outstanding_tvbs(void) { } } +void push_Tvb(lua_State* L, Tvb tvb) { + void** p = (void**)pushTvb(L,tvb); + g_ptr_array_add(outstanding_stuff,p); +} + /* diff --git a/plugins/lua/packet-lua.c b/plugins/lua/packet-lua.c index 3332be53e3..53bc30876e 100644 --- a/plugins/lua/packet-lua.c +++ b/plugins/lua/packet-lua.c @@ -154,9 +154,9 @@ void dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { if (lua_isfunction(L,1)) { - pushTvb(L,tvb); + push_Tvb(L,tvb); push_Pinfo(L,pinfo); - pushProtoTree(L,tree); + push_ProtoTree(L,tree); if ( lua_pcall(L,3,0,0) ) { const gchar* error = lua_tostring(L,-1); @@ -173,6 +173,8 @@ void dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { clear_outstanding_tvbs(); clear_outstanding_pinfos(); + clear_outstanding_trees(); + lua_pinfo = NULL; lua_tree = NULL; diff --git a/plugins/lua/packet-lua.h b/plugins/lua/packet-lua.h index 056a809c80..8311f99033 100644 --- a/plugins/lua/packet-lua.h +++ b/plugins/lua/packet-lua.h @@ -255,9 +255,14 @@ extern void proto_register_lua(void); extern GString* lua_register_all_taps(void); extern void lua_prime_all_fields(proto_tree* tree); extern void lua_register_subtrees(void); + +extern void push_Tvb(lua_State* L, Tvb tvb); extern void clear_outstanding_tvbs(void); + extern void push_Pinfo(lua_State* L, Pinfo p); extern void clear_outstanding_pinfos(void); + +extern void push_ProtoTree(lua_State* L, ProtoTree t); extern void clear_outstanding_trees(void); #endif