[gupnp] g_free is NULL-safe



commit c1ecb41b1793e655332c02db34fa914877c7dce3
Author: Jens Georg <mail jensge org>
Date:   Sat May 24 19:27:36 2014 +0200

    g_free is NULL-safe
    
    Signed-off-by: Jens Georg <mail jensge org>

 libgupnp/gupnp-context.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)
---
diff --git a/libgupnp/gupnp-context.c b/libgupnp/gupnp-context.c
index e2865e6..c13e89f 100644
--- a/libgupnp/gupnp-context.c
+++ b/libgupnp/gupnp-context.c
@@ -359,11 +359,7 @@ gupnp_context_finalize (GObject *object)
 
         context = GUPNP_CONTEXT (object);
 
-        if (context->priv->default_language) {
-                g_free (context->priv->default_language);
-                context->priv->default_language = NULL;
-        }
-
+        g_free (context->priv->default_language);
         g_free (context->priv->server_url);
 
         /* Call super */
@@ -754,9 +750,7 @@ host_path_data_set_language (HostPathData *data, const char *language)
 
         data->default_language = g_strdup (language);
 
-
-        if (old_language != NULL)
-                g_free (old_language);
+        g_free (old_language);
 }
 
 /**
@@ -790,8 +784,7 @@ gupnp_context_set_default_language (GUPnPContext *context,
                         (GFunc) host_path_data_set_language,
                         (gpointer) language);
 
-        if (old_language != NULL)
-                g_free (old_language);
+        g_free (old_language);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]