[PATCH] Fix crasher + leak when specifying domain in connect server dialog



The attached patch fixes bug 314730 [1] and a potential leak, since the
user variable was not freed if the preceding if branch wasn't reached.
Also, passing free'd pointers to g_strconcat is no good.

Sidenote: According to the GnomeVFS SMB-Method code, the domain/user
will be figured out correctly even if user is "".

[1] http://bugzilla.gnome.org/show_bug.cgi?id=314730

-- 
Christian Neumair <chris gnome-de org>
Index: src/nautilus-connect-server-dialog.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-connect-server-dialog.c,v
retrieving revision 1.14
diff -u -p -r1.14 nautilus-connect-server-dialog.c
--- src/nautilus-connect-server-dialog.c	27 May 2005 08:46:04 -0000	1.14
+++ src/nautilus-connect-server-dialog.c	13 Sep 2005 23:17:03 -0000
@@ -212,14 +212,16 @@ connect_to_server (NautilusConnectServer
 			g_free (t);
 		}
 		if (dialog->details->domain_entry->parent != NULL) {
-	
 			free_domain = TRUE;
 
 			domain = gtk_editable_get_chars (GTK_EDITABLE (dialog->details->domain_entry), 0, -1);
 			
 			if (strlen (domain) != 0) {
-				g_free (user);
+				free_user = TRUE;
+
+				t = user;
 				user = g_strconcat (domain , ";" , user, NULL);
+				g_free (t);
 			}
 		}
 

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]