diff options
author | Peter Wu <peter@lekensteyn.nl> | 2019-01-26 23:09:16 +0100 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2019-01-27 09:43:44 +0000 |
commit | e3a9cc6761c7e3d3401eb6e8d250e5cd89a1df50 (patch) | |
tree | d4d6e4e50c0dc2bbdf2fbf9ca4965a17f226d3f3 /epan/wslua | |
parent | 79fef2ae5042e600f1470f5ffa304578b1629876 (diff) |
wslua_pinfo: fix memleaks on setting addresses in Pinfo
Fixes memory leaks reported by ASAN for the test_wslua_pinfo test.
Change-Id: Id7e79e63559db1e7f8b27d566048eab9268d9237
Reviewed-on: https://code.wireshark.org/review/31754
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/wslua')
-rw-r--r-- | epan/wslua/wslua_pinfo.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c index 237b030b26..7410f0e808 100644 --- a/epan/wslua/wslua_pinfo.c +++ b/epan/wslua/wslua_pinfo.c @@ -165,10 +165,14 @@ static int Pinfo__tostring(lua_State *L) { lua_pushstring(L,"a Pinfo"); return 1 pushAddress(L,addr); \ }) +/* + * Addresses within the Pinfo structure are only valid for a single packet, so + * allocate memory from the pinfo pool. + */ #define PINFO_ADDRESS_SETTER(name) \ WSLUA_ATTRIBUTE_SET(Pinfo,name, { \ const address* from = checkAddress(L,-1); \ - copy_address(&(obj->ws_pinfo->name),from); \ + copy_address_wmem(obj->ws_pinfo->pool, &(obj->ws_pinfo->name), from); \ }) #define PINFO_NAMED_BOOLEAN_GETTER(name,member) \ |