pidgin: dc674f16: Some minor cleanup; removal of unnecessa...

datallah at pidgin.im datallah at pidgin.im
Tue Sep 16 10:25:29 EDT 2008


-----------------------------------------------------------------
Revision: dc674f16b04aac91ee251496098bac41e0fb56a0
Ancestor: f32f9fb19ff7b4685994c4120991d00386efee39
Author: datallah at pidgin.im
Date: 2008-09-16T14:23:24
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/dc674f16b04aac91ee251496098bac41e0fb56a0

Modified files:
        libpurple/proxy.c

ChangeLog: 

Some minor cleanup; removal of unnecessary frees and setting stuff to NULL
after freeing.
References #7047

-------------- next part --------------
============================================================
--- libpurple/proxy.c	67a1948a059b1f6d1f69ac9a5c3aa6fba3a083c5
+++ libpurple/proxy.c	d7fbf71c225304eda9dbfa8ef7857da17ec2549f
@@ -212,19 +212,21 @@ purple_gnome_proxy_get_info(void)
 {
 	static PurpleProxyInfo info = {0, NULL, 0, NULL, NULL};
 	gboolean use_same_proxy = FALSE;
-	gchar *tmp, *err;
+	gchar *tmp, *err = NULL;
 
 	tmp = g_find_program_in_path("gconftool-2");
 	if (tmp == NULL)
 		return purple_global_proxy_get_info();
 
 	g_free(tmp);
+	tmp = NULL;
 
 	/* Check whether to use a proxy. */
 	if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/mode",
 			&tmp, &err, NULL, NULL))
 		return purple_global_proxy_get_info();
 	g_free(err);
+	err = NULL;
 
 	if (!strcmp(tmp, "none\n")) {
 		info.type = PURPLE_PROXY_NONE;
@@ -239,6 +241,7 @@ purple_gnome_proxy_get_info(void)
 	}
 
 	g_free(tmp);
+	tmp = NULL;
 
 	/* Free the old fields */
 	if (info.host) {
@@ -258,16 +261,19 @@ purple_gnome_proxy_get_info(void)
 			&tmp, &err, NULL, NULL))
 		return purple_global_proxy_get_info();
 	g_free(err);
+	err = NULL;
 
 	if (!strcmp(tmp, "true\n"))
 		use_same_proxy = TRUE;
 	g_free(tmp);
+	tmp = NULL;
 
 	if (!use_same_proxy) {
 		if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/socks_host",
 			&info.host, &err, NULL, NULL))
 			return purple_global_proxy_get_info();
 		g_free(err);
+		err = NULL;
 	}
 
 	if(info.host != NULL)
@@ -280,10 +286,6 @@ purple_gnome_proxy_get_info(void)
 		{
 			g_free(info.host);
 			info.host = NULL;
-			g_free(info.username);
-			info.username = NULL;
-			g_free(info.password);
-			info.password = NULL;
 			return purple_global_proxy_get_info();
 		}
 		g_free(err);
@@ -295,6 +297,8 @@ purple_gnome_proxy_get_info(void)
 					&info.host, &err, NULL, NULL))
 			return purple_global_proxy_get_info();
 		g_free(err);
+		err = NULL;
+
 		/* If we get this far then we know we're using an HTTP proxy */
 		info.type = PURPLE_PROXY_HTTP;
 
@@ -314,11 +318,10 @@ purple_gnome_proxy_get_info(void)
 		{
 			g_free(info.host);
 			info.host = NULL;
-			g_free(info.username);
-			info.username = NULL;
 			return purple_global_proxy_get_info();
 		}
 		g_free(err);
+		err = NULL;
 		g_strchomp(info.username);
 
 		if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_password",
@@ -331,6 +334,7 @@ purple_gnome_proxy_get_info(void)
 			return purple_global_proxy_get_info();
 		}
 		g_free(err);
+		err = NULL;
 		g_strchomp(info.password);
 
 		if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/port",


More information about the Commits mailing list