/pidgin/main: e72f18aea857: oscar: Remove if() before g_free sin...

Youness Alaoui kakaroto at kakaroto.homelinux.net
Fri Jun 17 19:11:41 EDT 2016


Changeset: e72f18aea857b544b77b5e989b34ed362b2abf0b
Author:	 Youness Alaoui <kakaroto at kakaroto.homelinux.net>
Date:	 2016-06-16 13:09 -0400
Branch:	 oscar_auth
URL: https://hg.pidgin.im/pidgin/main/rev/e72f18aea857

Description:

oscar: Remove if() before g_free since g_free is NULL-aware

diffstat:

 libpurple/protocols/oscar/kerberos.c |  30 ++++++++++--------------------
 1 files changed, 10 insertions(+), 20 deletions(-)

diffs (59 lines):

diff --git a/libpurple/protocols/oscar/kerberos.c b/libpurple/protocols/oscar/kerberos.c
--- a/libpurple/protocols/oscar/kerberos.c
+++ b/libpurple/protocols/oscar/kerberos.c
@@ -93,8 +93,7 @@ static gchar *get_kdc_url(OscarData *od)
 	if (port != 443)
 		port_str = g_strdup_printf (":%d", port);
 	url = g_strdup_printf ("https://%s%s/", server, port_str ? port_str : "");
-	if (port_str)
-		g_free (port_str);
+	g_free (port_str);
 
 	return url;
 }
@@ -141,25 +140,18 @@ aim_xsnac_free(aim_xsnac_t *xsnac)
 {
 	gint i;
 
-	if (xsnac->principal1)
-		g_free (xsnac->principal1);
-	if (xsnac->principal2)
-		g_free (xsnac->principal2);
+	g_free (xsnac->principal1);
+	g_free (xsnac->principal2);
 	aim_tlvlist_free (xsnac->tlvlist);
 
 	for (i = 0; i < xsnac->num_tokens; i++) {
 		g_free(xsnac->tokens[i].main_tlv->value);
 		g_free(xsnac->tokens[i].main_tlv);
-		if (xsnac->tokens[i].principal1)
-			g_free (xsnac->tokens[i].principal1);
-		if (xsnac->tokens[i].principal1_again)
-		if (xsnac->tokens[i].service)
-			g_free (xsnac->tokens[i].service);
-			g_free (xsnac->tokens[i].principal1_again);
-		if (xsnac->tokens[i].principal2)
-			g_free (xsnac->tokens[i].principal2);
-		if (xsnac->tokens[i].footer)
-			g_free (xsnac->tokens[i].footer);
+		g_free (xsnac->tokens[i].principal1);
+		g_free (xsnac->tokens[i].service);
+		g_free (xsnac->tokens[i].principal1_again);
+		g_free (xsnac->tokens[i].principal2);
+		g_free (xsnac->tokens[i].footer);
 		aim_tlvlist_free (xsnac->tokens[i].tlvlist);
 	}
 	g_free (xsnac->tokens);
@@ -315,10 +307,8 @@ kerberos_login_cb(PurpleHttpConnection *
 			_("Unknown error during authentication"));
 	}
 	aim_xsnac_free (&xsnac);
-	if (tlsCertName)
-		g_free (tlsCertName);
-	if (bosip)
-		g_free (bosip);
+	g_free (tlsCertName);
+	g_free (bosip);
 }
 
 /**



More information about the Commits mailing list