changeset 24050:d4239c588fcf

Some minor cleanup; removal of unnecessary frees and setting stuff to NULL after freeing. References #7047
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 16 Sep 2008 14:23:24 +0000
parents 0bd896cd1b90
children 3b968076a5dc
files libpurple/proxy.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/proxy.c	Tue Sep 16 13:04:39 2008 +0000
+++ b/libpurple/proxy.c	Tue Sep 16 14:23:24 2008 +0000
@@ -212,19 +212,21 @@
 {
 	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 @@
 	}
 
 	g_free(tmp);
+	tmp = NULL;
 
 	/* Free the old fields */
 	if (info.host) {
@@ -258,16 +261,19 @@
 			&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 @@
 		{
 			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 @@
 					&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 @@
 		{
 			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 @@
 			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",