Wireshark-commits: [Wireshark-commits] master e3541af: Fix minor leak in filter_expression_new.
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sat, 28 Apr 2018 16:28:30 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=e3541af62e5432fe5a1f269ec2f35ae07235f2ad
Submitter: Peter Wu (peter@xxxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark

Commits:

e3541af by Darius Davis (darius@xxxxxxxxxx):

    Fix minor leak in filter_expression_new.
    
    filter_expression_new was g_strdup()ing each of the strings in the "expression"
    structure, but UAT is just going to immediately deep copy the structure (via
    display_filter_copy_cb), so the copies made here are immediately leaking.
    
    We could either free() these copies immediately after uat_add_record returns,
    or skip the g_strdup altogether (which necessitates casting away the "const").
    I chose the latter.
    
    Testing Done: Linux x64 build.  With a display filter configured in
       ~/.wireshark/preferences, Valgrind no longer reports three leaks from here.
    
    Change-Id: I7913f260875ced597b9027c8ae92a4d6d44f6414
    Reviewed-on: https://code.wireshark.org/review/27157
    Petri-Dish: Peter Wu <peter@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Peter Wu <peter@xxxxxxxxxxxxx>
    

Actions performed:

    from  3924c6e   lwm2mtlv: Handle String data type as UTF-8
    adds  e3541af   Fix minor leak in filter_expression_new.


Summary of changes:
 epan/filter_expressions.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)