aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_listener.c
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2008-07-26 23:41:31 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2008-07-26 23:41:31 +0000
commit006e41af1227d23fa30b8ad540603303e6e96bff (patch)
treecede1b6e4568e7ebd148b7542dc91c5140236b93 /epan/wslua/wslua_listener.c
parent5ad5441634bd440d99db9db76a207862e3af459d (diff)
From Balint Reczey
Fix for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2453 The patch fixes the problem by extending the original "outstanding stuff" approach. Now the pointer itself won't be NULLified, instead we track the pointers with their expiry state in structs in the outstanding_stuff list. The Lua objects refers to those structs instead of the actual pointers and checks the expiry state of the pointers before accessing them. The pointers are marked expired when the dissection of the frame is finished and the allocated struct is freed by Lua's garbage collector. If the garbage collector hits the struct when it holds a not expired pointer, it marks it as expired (that means we don't have any object in Lua referring to the pointer) and the struct will be freed at the end of the dissection of the frame. this is for the 1.0 branch svn path=/trunk/; revision=25845
Diffstat (limited to 'epan/wslua/wslua_listener.c')
-rw-r--r--epan/wslua/wslua_listener.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/epan/wslua/wslua_listener.c b/epan/wslua/wslua_listener.c
index 800956d421..0571626e05 100644
--- a/epan/wslua/wslua_listener.c
+++ b/epan/wslua/wslua_listener.c
@@ -100,9 +100,10 @@ int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const
lua_pinfo = pinfo;
lua_tvb = edt->tvb;
- lua_tree = ep_alloc(sizeof(struct _wslua_treeitem));
+ lua_tree = g_malloc(sizeof(struct _wslua_treeitem));
lua_tree->tree = edt->tree;
lua_tree->item = NULL;
+ lua_tree->expired = FALSE;
switch ( lua_pcall(tap->L,3,1,1) ) {
case 0:
@@ -118,8 +119,8 @@ int lua_tap_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt, const
break;
}
- clear_outstanding_pinfos();
- clear_outstanding_tvbs();
+ clear_outstanding_Pinfo();
+ clear_outstanding_Tvb();
lua_pinfo = NULL;
lua_tvb = NULL;