summaryrefslogtreecommitdiff
path: root/mate-dictionary
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-12-21 10:36:42 +0100
committerLuke from DC <[email protected]>2022-01-21 02:05:34 +0000
commit128b0c963bc05af77247b1888ee6ed8cb89f550d (patch)
treef28b44d940c0ad21530a09600e74f35531dc960e /mate-dictionary
parentf2f464fc5c7997d5d62d559306fe6a74c1021878 (diff)
downloadmate-utils-128b0c963bc05af77247b1888ee6ed8cb89f550d.tar.bz2
mate-utils-128b0c963bc05af77247b1888ee6ed8cb89f550d.tar.xz
Redundant null check before freeing the variable
Diffstat (limited to 'mate-dictionary')
-rw-r--r--mate-dictionary/libgdict/gdict-client-context.c16
-rw-r--r--mate-dictionary/libgdict/gdict-source.c3
2 files changed, 6 insertions, 13 deletions
diff --git a/mate-dictionary/libgdict/gdict-client-context.c b/mate-dictionary/libgdict/gdict-client-context.c
index c52148f6..7d42d5fd 100644
--- a/mate-dictionary/libgdict/gdict-client-context.c
+++ b/mate-dictionary/libgdict/gdict-client-context.c
@@ -407,8 +407,7 @@ gdict_client_context_set_property (GObject *object,
switch (prop_id)
{
case PROP_HOSTNAME:
- if (priv->hostname)
- g_free (priv->hostname);
+ g_free (priv->hostname);
priv->hostname = g_strdup (g_value_get_string (value));
gdict_client_context_clear_hostinfo (GDICT_CLIENT_CONTEXT (object));
break;
@@ -416,8 +415,7 @@ gdict_client_context_set_property (GObject *object,
priv->port = g_value_get_uint (value);
break;
case PROP_CLIENT_NAME:
- if (priv->client_name)
- g_free (priv->client_name);
+ g_free (priv->client_name);
priv->client_name = g_strdup (g_value_get_string (value));
break;
case GDICT_CONTEXT_PROP_LOCAL_ONLY:
@@ -469,8 +467,7 @@ gdict_client_context_finalize (GObject *object)
/* force disconnection */
gdict_client_context_force_disconnect (context);
- if (priv->command)
- gdict_command_free (priv->command);
+ gdict_command_free (priv->command);
if (priv->commands_queue)
{
@@ -479,11 +476,8 @@ gdict_client_context_finalize (GObject *object)
priv->commands_queue = NULL;
}
- if (priv->client_name)
- g_free (priv->client_name);
-
- if (priv->hostname)
- g_free (priv->hostname);
+ g_free (priv->client_name);
+ g_free (priv->hostname);
#ifdef ENABLE_IPV6
if (priv->host6info)
diff --git a/mate-dictionary/libgdict/gdict-source.c b/mate-dictionary/libgdict/gdict-source.c
index 7f7f35e4..e2c58494 100644
--- a/mate-dictionary/libgdict/gdict-source.c
+++ b/mate-dictionary/libgdict/gdict-source.c
@@ -395,8 +395,7 @@ gdict_source_create_context (GdictSource *source,
context = gdict_client_context_new (hostname, port);
- if (hostname)
- g_free (hostname);
+ g_free (hostname);
}
break;
default: