Wireshark-commits: [Wireshark-commits] master 45674b7: Qt: fix "Assigned value is garbage or undefi
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=45674b7a0402e8ee980de4a845b6d1a3753e2e7a
Submitter: Gerald Combs (gerald@xxxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark
Commits:
45674b7 by Peter Wu (peter@xxxxxxxxxxxxx):
Qt: fix "Assigned value is garbage or undefined"
Clang Static Analyzer reported that function link_changed uses a garbage
value for "device.links" which is indeed the case when
global_capture_opts.all_ifaces->len == 0.
There seem to be some issues here:
- When global_capture_opts.all_ifaces->len == 0, then device is
uninitialized.
- When no interface name matches, the last entry will always be
updated.
- There is duplicate code querying for the interface by name.
This patch addresses the above issues by extracting the interface name
check into a new utility function which returns NULL when a device is
not found. Then the callers (such as link_changed) will check this
value.
While at it, stop storing a copy of (interface_t), use a pointer
instead. This allows for removal of g_array_remove_index followed by
g_array_insert_val.
Verified with clang 3.5.1.
Change-Id: I03e0f179577a23a3f1efdca768e67922273192f0
Reviewed-on: https://code.wireshark.org/review/7145
Petri-Dish: Gerald Combs <gerald@xxxxxxxxxxxxx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@xxxxxxxxxxxxx>
Reviewed-by: Gerald Combs <gerald@xxxxxxxxxxxxx>
Actions performed:
from ea5f5be Update Release Notes
adds 45674b7 Qt: fix "Assigned value is garbage or undefined"
Summary of changes:
ui/qt/capture_interfaces_dialog.cpp | 266 +++++++++++++++--------------------
1 file changed, 115 insertions(+), 151 deletions(-)