[librest/wip/baedert/tests: 19/27] OAuth2Proxy: g_free is null-safe



commit 2f828797fd2334efc5baa08da2947a9071b6478f
Author: Timm Bäder <mail baedert org>
Date:   Tue Aug 2 12:12:22 2016 +0200

    OAuth2Proxy: g_free is null-safe

 rest/oauth2-proxy.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/rest/oauth2-proxy.c b/rest/oauth2-proxy.c
index 2d3315b..c312fcf 100644
--- a/rest/oauth2-proxy.c
+++ b/rest/oauth2-proxy.c
@@ -88,18 +88,15 @@ oauth2_proxy_set_property (GObject *object, guint property_id,
 
   switch (property_id) {
   case PROP_CLIENT_ID:
-    if (priv->client_id)
-      g_free (priv->client_id);
+    g_free (priv->client_id);
     priv->client_id = g_value_dup_string (value);
     break;
   case PROP_AUTH_ENDPOINT:
-    if (priv->auth_endpoint)
-      g_free (priv->auth_endpoint);
+    g_free (priv->auth_endpoint);
     priv->auth_endpoint = g_value_dup_string (value);
     break;
   case PROP_ACCESS_TOKEN:
-    if (priv->access_token)
-      g_free (priv->access_token);
+    g_free (priv->access_token);
     priv->access_token = g_value_dup_string (value);
     break;
   default:
@@ -363,9 +360,7 @@ oauth2_proxy_set_access_token (OAuth2Proxy *proxy, const char *access_token)
 {
   g_return_if_fail (OAUTH2_IS_PROXY (proxy));
 
-  if (proxy->priv->access_token)
-    g_free (proxy->priv->access_token);
-
+  g_free (proxy->priv->access_token);
   proxy->priv->access_token = g_strdup (access_token);
 }
 


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