From c7c4c3bf5e3fdb5f95f92e881743ef8e7ad779f1 Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Mon, 14 Jul 2014 15:37:06 +0200 Subject: [PATCH] Remove redundant checks before free Remove checks for NULL before g_free(). https://bugzilla.gnome.org/show_bug.cgi?id=733156 --- gio/fen/fen-kernel.c | 4 +--- gio/gdbusintrospection.c | 3 +-- gio/gnetworkaddress.c | 3 +-- gio/gnetworkservice.c | 3 +-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/gio/fen/fen-kernel.c b/gio/fen/fen-kernel.c index a724f2f..8277fab 100644 --- a/gio/fen/fen-kernel.c +++ b/gio/fen/fen-kernel.c @@ -460,9 +460,7 @@ printevent (const char *pname, int event, const char *tag) static gchar *event_string = NULL; GString *str; - if (event_string) { - g_free(event_string); - } + g_free(event_string); str = g_string_new (""); g_string_printf (str, "[%s] [%-20s]", tag, pname); diff --git a/gio/gdbusintrospection.c b/gio/gdbusintrospection.c index 0c501c4..6d3ff93 100644 --- a/gio/gdbusintrospection.c +++ b/gio/gdbusintrospection.c @@ -1827,8 +1827,7 @@ g_dbus_node_info_new_for_xml (const gchar *xml_data, g_free (ughret); out: - if (parser != NULL) - g_free (parser); + g_free (parser); if (context != NULL) g_markup_parse_context_free (context); diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c index 0519713..5cb4c74 100644 --- a/gio/gnetworkaddress.c +++ b/gio/gnetworkaddress.c @@ -181,8 +181,7 @@ g_network_address_set_property (GObject *object, break; case PROP_SCHEME: - if (addr->priv->scheme) - g_free (addr->priv->scheme); + g_free (addr->priv->scheme); addr->priv->scheme = g_value_dup_string (value); break; diff --git a/gio/gnetworkservice.c b/gio/gnetworkservice.c index fb37620..497d6fd 100644 --- a/gio/gnetworkservice.c +++ b/gio/gnetworkservice.c @@ -350,8 +350,7 @@ g_network_service_set_scheme (GNetworkService *srv, { g_return_if_fail (G_IS_NETWORK_SERVICE (srv)); - if (srv->priv->scheme) - g_free (srv->priv->scheme); + g_free (srv->priv->scheme); srv->priv->scheme = g_strdup (scheme); g_object_notify (G_OBJECT (srv), "scheme"); -- 2.7.4