Description: avoid crashes due to running out of file descriptors A bad code path encountered when socketpair() fails will result in a NULL pointer dereference. This situation occurs on an unaltered Ubuntu system at around 400 or so connections. Author: Stephen M. Webb Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/1065082 Bug-Gnome: https://bugzilla.gnome.org/show_bug.cgi?id=696713 === modified file 'daemon/gvfsjobopenforread.c' --- old/daemon/gvfsjobopenforread.c 2012-10-29 14:51:48 +0000 +++ new/daemon/gvfsjobopenforread.c 2013-03-27 19:04:09 +0000 @@ -178,7 +178,7 @@ fd_list = g_unix_fd_list_new (); error = NULL; fd_id = g_unix_fd_list_append (fd_list, remote_fd, &error); - if (fd_id == -1) + if (fd_id == -1 && error) { g_warning ("create_reply: %s (%s, %d)\n", error->message, g_quark_to_string (error->domain), error->code); g_error_free (error); === modified file 'daemon/gvfsjobopenforwrite.c' --- old/daemon/gvfsjobopenforwrite.c 2012-10-29 14:51:48 +0000 +++ new/daemon/gvfsjobopenforwrite.c 2013-03-27 19:03:51 +0000 @@ -262,7 +262,7 @@ fd_list = g_unix_fd_list_new (); error = NULL; fd_id = g_unix_fd_list_append (fd_list, remote_fd, &error); - if (fd_id == -1) + if (fd_id == -1 && error) { g_warning ("create_reply: %s (%s, %d)\n", error->message, g_quark_to_string (error->domain), error->code); g_error_free (error);