# HG changeset patch # User Daniel Atallah # Date 1221575004 0 # Node ID d4239c588fcfca6ae0eb0a4f0d1c7ae82f97aaac # Parent 0bd896cd1b9066525c598f7b7e10ae59b05a13c8 Some minor cleanup; removal of unnecessary frees and setting stuff to NULL after freeing. References #7047 diff -r 0bd896cd1b90 -r d4239c588fcf libpurple/proxy.c --- 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",