Wireshark-commits: [Wireshark-commits] master 44870fb: wslua: Fix two memory leaks in the lua tests

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sat, 26 Oct 2019 13:27:52 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=44870fb1c2d9a41a63a466a41a625d2b674b99e1
Submitter: "Anders Broman <a.broman58@xxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

44870fb by Vasil Velichkov (vvvelichkov@xxxxxxxxx):

    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@xxxxxxxxxxxxx>
    Petri-Dish: Gerald Combs <gerald@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Anders Broman <a.broman58@xxxxxxxxx>
    

Actions performed:

    from  dc3cdf8   Release notes: We're building with VS 2019 on Windows.
     add  44870fb   wslua: Fix two memory leaks in the lua tests


Summary of changes:
 test/lua/protofield.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)