changeset 24118:0bd896cd1b90

Fix a double free. Fixes #7047
author Stu Tomlinson <stu@nosnilmot.com>
date Tue, 16 Sep 2008 13:04:39 +0000
parents bcfc98c7a55f
children d4239c588fcf
files libpurple/proxy.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/proxy.c	Mon Sep 15 03:06:03 2008 +0000
+++ b/libpurple/proxy.c	Tue Sep 16 13:04:39 2008 +0000
@@ -263,13 +263,17 @@
 		use_same_proxy = TRUE;
 	g_free(tmp);
 
-	if (!use_same_proxy && !g_spawn_command_line_sync("gconftool-2 -g /system/proxy/socks_host",
+	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);
-	g_strchomp(info.host);
+			return purple_global_proxy_get_info();
+		g_free(err);
+	}
 
-	if (!use_same_proxy && *info.host != '\0') {
+	if(info.host != NULL)
+		g_strchomp(info.host);
+
+	if (!use_same_proxy && (info.host != NULL) && (*info.host != '\0')) {
 		info.type = PURPLE_PROXY_SOCKS5;
 		if (!g_spawn_command_line_sync("gconftool-2 -g /system/proxy/socks_port",
 				&tmp, &err, NULL, NULL))