aboutsummaryrefslogtreecommitdiffstats
path: root/ui/gtk/capture_file_dlg.c
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2017-08-26 10:30:47 +0200
committerJoão Valverde <j@v6e.pt>2017-10-15 12:38:51 +0000
commit9d49e1316689ae05d31efc866f04ac12cd051085 (patch)
treef51b835fd490fe6be49268a114014f597f47c252 /ui/gtk/capture_file_dlg.c
parent37ccb77a1ab845075465c2d86eea9e8e21abc273 (diff)
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>
Diffstat (limited to 'ui/gtk/capture_file_dlg.c')
-rw-r--r--ui/gtk/capture_file_dlg.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index c1c5d7aac0..5738f232bf 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -930,8 +930,7 @@ file_merge_cmd(GtkWidget *w _U_)
}
if (merge_status != CF_OK) {
- if (rfcode != NULL)
- dfilter_free(rfcode);
+ dfilter_free(rfcode);
g_free(tmpname);
continue;
}
@@ -941,8 +940,7 @@ file_merge_cmd(GtkWidget *w _U_)
/* Try to open the merged capture file. This closes the current file if it succeeds. */
if (cf_open(&cfile, tmpname, WTAP_TYPE_AUTO, TRUE /* temporary file */, &err) != CF_OK) {
/* We couldn't open it; fail. */
- if (rfcode != NULL)
- dfilter_free(rfcode);
+ dfilter_free(rfcode);
g_free(tmpname);
g_string_free(file_name, TRUE);
g_string_free(display_filter, TRUE);