summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2009-02-05 22:23:15 +0000
committerBrian Cameron <bcameron@src.gnome.org>2009-02-05 22:23:15 +0000
commitb9eaa11457c4f17b7631c89888b926c7316ed9a5 (patch)
tree5b7210c159585ceb7a938406c589ca59476abcbc
parent240ab873003731239fc88ef0c9aaa3608a0ed384 (diff)
downloadgdm-b9eaa11457c4f17b7631c89888b926c7316ed9a5.tar.gz
Remove double free and improve error handling, patch by Chris Wilson
2009-02-05 Brian Cameron <brian.cameron@sun.com> * daemon/gdm-xdmcp-manager.c: Remove double free and improve error handling, patch by Chris Wilson (chris+gnome@aptivate.org). Also fix how the host variable is freed in gdm_xdmcp_handle_message so it is not freed before it is last used. This issue was noticed by Giuseppe Lippolis (giuseppe.lippolis@thalesaleniaspace.com). Fixes two issues noted in bug #530585, though I suspect it does not resolve the main issue of the bug.. * daemon/server.c: Improve error handling. svn path=/branches/gnome-2-20/; revision=6682
-rw-r--r--ChangeLog11
-rw-r--r--daemon/gdm-xdmcp-manager.c10
-rw-r--r--daemon/server.c8
3 files changed, 23 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 24f541ec..d62b50e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-02-05 Brian Cameron <brian.cameron@sun.com>
+
+ * daemon/gdm-xdmcp-manager.c: Remove double free and improve error
+ handling, patch by Chris Wilson (chris+gnome@aptivate.org). Also fix
+ how the host variable is freed in gdm_xdmcp_handle_message so it
+ is not freed before it is last used. This issue was noticed by
+ Giuseppe Lippolis (giuseppe.lippolis@thalesaleniaspace.com). Fixes
+ two issues noted in bug #530585, though I suspect it does not
+ resolve the main issue of the bug..
+ * daemon/server.c: Improve error handling.
+
2009-01-06 Brian Cameron <brian.cameron@sun.com>
* daemon/server.c, daemon/gdm-daemon-config.c: Set default
diff --git a/daemon/gdm-xdmcp-manager.c b/daemon/gdm-xdmcp-manager.c
index 9f12f681..fd262eac 100644
--- a/daemon/gdm-xdmcp-manager.c
+++ b/daemon/gdm-xdmcp-manager.c
@@ -401,12 +401,12 @@ create_socket (struct addrinfo *ai)
sock = socket (ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (sock < 0) {
- gdm_debug ("socket: %s", g_strerror (errno));
+ gdm_error ("socket: %s", g_strerror (errno));
return sock;
}
if (bind (sock, ai->ai_addr, ai->ai_addrlen) < 0) {
- gdm_debug ("bind: %s", g_strerror (errno));
+ gdm_error ("bind: %s", g_strerror (errno));
close (sock);
return -1;
}
@@ -728,7 +728,6 @@ gdm_xdmcp_send_willing (GdmXdmcpManager *manager,
s = get_willing_output (manager);
if (s != NULL) {
- g_free (last_status);
last_status = s;
} else {
last_status = g_strdup (manager->priv->sysid);
@@ -2169,12 +2168,12 @@ gdm_xdmcp_handle_manage (GdmXdmcpManager *manager,
g_free (host);
return;
}
- g_free (host);
/* SessionID */
if G_UNLIKELY (! XdmcpReadCARD32 (&manager->priv->buf, &clnt_sessid)) {
gdm_debug ("%s: Could not read Session ID",
"gdm_xdmcp_handle_manage");
+ g_free (host);
return;
}
@@ -2182,6 +2181,7 @@ gdm_xdmcp_handle_manage (GdmXdmcpManager *manager,
if G_UNLIKELY (! XdmcpReadCARD16 (&manager->priv->buf, &clnt_dspnum)) {
gdm_debug ("%s: Could not read Display Number",
"gdm_xdmcp_handle_manage");
+ g_free (host);
return;
}
@@ -2189,6 +2189,7 @@ gdm_xdmcp_handle_manage (GdmXdmcpManager *manager,
if G_UNLIKELY (! XdmcpReadARRAY8 (&manager->priv->buf, &clnt_dspclass)) {
gdm_debug ("%s: Could not read Display Class",
"gdm_xdmcp_handle_manage");
+ g_free (host);
return;
}
@@ -2198,6 +2199,7 @@ gdm_xdmcp_handle_manage (GdmXdmcpManager *manager,
(int)clnt_dspnum, (long)clnt_sessid, ve_sure_string (s), host);
g_free (s);
}
+ g_free (host);
d = gdm_xdmcp_display_lookup (manager, clnt_sessid);
if (d != NULL &&
diff --git a/daemon/server.c b/daemon/server.c
index 9fbae768..ad0becb9 100644
--- a/daemon/server.c
+++ b/daemon/server.c
@@ -974,15 +974,19 @@ gdm_server_resolve_command_line (GdmDisplay *disp,
g_shell_parse_argv (str, &argc, &argv, NULL);
} else {
+ GError* error_p;
char **svr_command;
const char *str;
int svr_argc;
str = ve_sure_string (svr->command);
svr_command = NULL;
- g_shell_parse_argv (str, &svr_argc, &svr_command, NULL);
- g_shell_parse_argv (disp->command, &argc, &argv, NULL);
+ g_shell_parse_argv (str, &svr_argc,
+ &svr_command, &error_p);
+
+ g_shell_parse_argv (disp->command, &argc,
+ &argv, &error_p);
if (argv[0] == NULL || argv[1] == NULL) {
g_strfreev (argv);