Remove superfluous null-checks before strdup/free
authorAhmad Fatoum <ahmad@a3f.at>
Sat, 26 Aug 2017 08:30:47 +0000 (10:30 +0200)
committerJoão Valverde <j@v6e.pt>
Sun, 15 Oct 2017 12:38:51 +0000 (12:38 +0000)
commit9d49e1316689ae05d31efc866f04ac12cd051085
treef51b835fd490fe6be49268a114014f597f47c252
parent37ccb77a1ab845075465c2d86eea9e8e21abc273
Remove superfluous null-checks before strdup/free

NULL checks were removed for following free functions:

- g_free "If mem is NULL it simply returns"
  https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free

- g_slist_free(_full)? "NULL is considered to be the empty list"
  https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html

- g_strfreev "If str_array is NULL, this function simply returns."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev

- g_slice_free "If mem is NULL, this macro does nothing."
  https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free

- g_match_info_free "not NULL... otherwise does nothing"
  https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free

- dfilter_free defined in Wireshark code. Returns early when passed NULL
  epan/dfilter/dfilter.c

They were also removed around calls to g_strdup where applicable:

- g_strdup "If str is NULL it returns NULL."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup

Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04
Reviewed-on: https://code.wireshark.org/review/23406
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
89 files changed:
capture_opts.c
caputils/airpcap_loader.c
epan/color_filters.c
epan/crypt/airpdcap.c
epan/dfilter/dfilter-macro.c
epan/dissectors/asn1/kerberos/packet-kerberos-template.c
epan/dissectors/asn1/ldap/packet-ldap-template.c
epan/dissectors/packet-ber.c
epan/dissectors/packet-bootp.c
epan/dissectors/packet-corosync-totemnet.c
epan/dissectors/packet-dcerpc.c
epan/dissectors/packet-dof.c
epan/dissectors/packet-dvbci.c
epan/dissectors/packet-epl.c
epan/dissectors/packet-gsm_sms.c
epan/dissectors/packet-http.c
epan/dissectors/packet-ieee80211.c
epan/dissectors/packet-ipsec.c
epan/dissectors/packet-kerberos.c
epan/dissectors/packet-l2tp.c
epan/dissectors/packet-ldap.c
epan/dissectors/packet-pdcp-lte.c
epan/dissectors/packet-reload.c
epan/dissectors/packet-sctp.c
epan/dissectors/packet-sip.c
epan/dissectors/packet-smb.c
epan/dissectors/packet-udp-nm.c
epan/dissectors/packet-umts_fp.c
epan/dissectors/packet-zbee-nwk-gp.c
epan/dissectors/packet-zbee-security.c
epan/dtd_grammar.lemon
epan/dtd_parse.l
epan/dtd_preparse.l
epan/expert.c
epan/geoip_db.c
epan/plugin_if.c
epan/prefs.c
epan/radius_dict.l
epan/reassemble.c
epan/srt_table.c
epan/tap.c
epan/wslua/lrexlib_glib.c
epan/wslua/wslua_capture_info.c
epan/wslua/wslua_dir.c
epan/wslua/wslua_file.c
epan/wslua/wslua_frame_info.c
epan/wslua/wslua_listener.c
extcap/sshdump.c
extcap_parser.c
file.c
plugins/mate/mate_grammar.lemon
tools/lemon/lemon.c
ui/cli/tap-comparestat.c
ui/cli/tap-httpstat.c
ui/cli/tap-icmpstat.c
ui/cli/tap-icmpv6stat.c
ui/cli/tap-iostat.c
ui/cli/tap-protohierstat.c
ui/cli/tap-rtspstat.c
ui/cli/tap-sipstat.c
ui/cli/tap-wspstat.c
ui/gtk/airpcap_gui_utils.c
ui/gtk/capture_dlg.c
ui/gtk/capture_file_dlg.c
ui/gtk/color_edit_dlg.c
ui/gtk/extcap_gtk.c
ui/gtk/funnel_stat.c
ui/gtk/io_stat.c
ui/gtk/mac_lte_stat_dlg.c
ui/gtk/main.c
ui/gtk/main_welcome.c
ui/gtk/prefs_capture.c
ui/gtk/rlc_lte_stat_dlg.c
ui/iface_lists.c
ui/language.c
ui/proto_hier_stats.c
ui/qt/main_window.cpp
ui/qt/main_window_preferences_frame.cpp
ui/qt/main_window_slots.cpp
ui/recent.c
ui/voip_calls.c
ui/win32/file_dlg_win32.c
wiretap/catapult_dct2000.c
wiretap/file_access.c
wiretap/ngsniffer.c
wiretap/pppdump.c
wiretap/visual.c
wiretap/wtap.c
wsutil/interface.c