diff options
author | Paul Szabo <psz@maths.usyd.edu.au> | 2015-08-14 14:59:56 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2015-08-14 15:12:52 -0400 |
commit | 6f8c1196edcae1dbc72722d57b66fd958fdb7f92 (patch) | |
tree | 98a3f2062e96b90f00f3aa99d65e07c3f4abbaa7 /daemon | |
parent | 0539a8ba46995361241a6979759a0dd480a734d4 (diff) | |
download | gdm-6f8c1196edcae1dbc72722d57b66fd958fdb7f92.tar.gz |
session-record: fix use after free
hostname is getting freed before it's getting used if ut_syslen
is available.
This commit moves the free down a couple of lines
https://bugzilla.gnome.org/show_bug.cgi?id=599103
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/gdm-session-record.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/daemon/gdm-session-record.c b/daemon/gdm-session-record.c index 33232526..89c11a87 100644 --- a/daemon/gdm-session-record.c +++ b/daemon/gdm-session-record.c @@ -161,11 +161,10 @@ record_set_host (UTMP *u, if (hostname != NULL) { strncpy (u->ut_host, hostname, sizeof (u->ut_host)); g_debug ("using ut_host %.*s", (int) sizeof (u->ut_host), u->ut_host); - g_free (hostname); - #ifdef HAVE_UT_UT_SYSLEN u->ut_syslen = MIN (strlen (hostname), sizeof (u->ut_host)); #endif + g_free (hostname); } #endif } |