From 9d49e1316689ae05d31efc866f04ac12cd051085 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sat, 26 Aug 2017 10:30:47 +0200 Subject: Remove superfluous null-checks before strdup/free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Tested-by: Petri Dish Buildbot Reviewed-by: João Valverde --- plugins/mate/mate_grammar.lemon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/mate/mate_grammar.lemon') diff --git a/plugins/mate/mate_grammar.lemon b/plugins/mate/mate_grammar.lemon index b788ac425f..4b9ac3195f 100644 --- a/plugins/mate/mate_grammar.lemon +++ b/plugins/mate/mate_grammar.lemon @@ -187,7 +187,7 @@ static gchar* recolonize(mate_config* mc, gchar* s) { %token_type { gchar* } %token_destructor { (void) mc; /* Mark unused, similar to Q_UNUSED */ - if ($$) g_free($$); + g_free($$); } %extra_argument { mate_config* mc } -- cgit v1.2.1