aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVasil Velichkov <vvvelichkov@gmail.com>2019-10-23 00:02:56 +0300
committerAnders Broman <a.broman58@gmail.com>2019-10-26 13:27:45 +0000
commit44870fb1c2d9a41a63a466a41a625d2b674b99e1 (patch)
treea057e8797a30ce9656338c54191aa0b9f0246f50 /test
parentdc3cdf87a523b6375684585f7ed826eefdb818ab (diff)
wslua: Fix two memory leaks in the lua tests
Add the newly create ProtoField to the test_proto.fields in order to be freed. ERROR: LeakSanitizer: detected memory leaks Direct leak of 64 byte(s) in 1 object(s) allocated from: #0 0x55e041f5ef86 in realloc (/home/vasko/sources/wireshark/build_clang/run/tshark+0x222f86) #1 0x7fd8e0919e7d in g_realloc gmem.c:164:16 #2 0x7fd8e08e457b in g_array_maybe_expand garray.c:820:21 #3 0x7fd8e08e4b49 in g_array_append_vals garray.c:428:3 #4 0x7fd8ef112b6e in value_string_from_table /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:294:9 #5 0x7fd8ef10ee10 in ProtoField_new /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:646:24 Direct leak of 32 byte(s) in 1 object(s) allocated from: #0 0x55e041f5ef86 in realloc (/home/vasko/sources/wireshark/build_clang/run/tshark+0x222f86) #1 0x7fd8e0919e7d in g_realloc gmem.c:164:16 #2 0x7fd8e08e457b in g_array_maybe_expand garray.c:820:21 #3 0x7fd8e08e4b49 in g_array_append_vals garray.c:428:3 #4 0x7fd8ef111e2e in range_string_from_table /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:226:17 #5 0x7fd8ef10e43f in ProtoField_new /home/vasko/sources/wireshark/epan/wslua/wslua_proto_field.c:642:24 Fixes: v3.1.1rc0-497-g0371994223 ("wslua: Improve parameter check in ProtoField.new()") Change-Id: I05b8bf3d78c8a540c6cf33d11dc3f3e01f83b8c5 Reviewed-on: https://code.wireshark.org/review/34834 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/lua/protofield.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/lua/protofield.lua b/test/lua/protofield.lua
index 2fcfafb2fd..1cfc9fa184 100644
--- a/test/lua/protofield.lua
+++ b/test/lua/protofield.lua
@@ -79,7 +79,7 @@ test("ProtoField-char", success)
success = pcall(ProtoField.new, "char base NONE without valuestring", "test.char1", ftypes.CHAR, nil, base.NONE)
test("ProtoField-char-without-valuestring", not success)
-success = pcall(ProtoField.new, "char base NONE with valuestring", "test.char2", ftypes.CHAR, {1, "Value"}, base.NONE)
+success, test_proto.fields.char2 = pcall(ProtoField.new, "char base NONE with valuestring", "test.char2", ftypes.CHAR, {1, "Value"}, base.NONE)
test("ProtoField-char-with-valuestring", success)
success = pcall(ProtoField.new, "char base DEC", "test.char3", ftypes.CHAR, nil, base.DEC)
@@ -88,7 +88,7 @@ test("ProtoField-char-base-dec", not success)
success = pcall(ProtoField.new, "char base UNIT_STRING", "test.char4", ftypes.CHAR, {" m"}, base.UNIT_STRING)
test("ProtoField-char-unit-string", not success)
-success = pcall(ProtoField.new, "char base RANGE_STRING", "test.char5", ftypes.CHAR, {{1, 2, "Value"}}, base.RANGE_STRING)
+success, test_proto.fields.char5 = pcall(ProtoField.new, "char base RANGE_STRING", "test.char5", ftypes.CHAR, {{1, 2, "Value"}}, base.RANGE_STRING)
test("ProtoField-char-range-string", success)
-- Field name: empty, illegal, incompatible