diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-05-16 20:14:10 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2007-05-16 20:14:10 -0700 |
commit | 0022cf7baf11bccea0024d0dc8c1ecc37e46ef3d (patch) | |
tree | 5567e369ef5cc56056eb5b374b9c51c5a991c5c3 | |
parent | f749d926bd9796badee2efd1ee1da5905d6fd38d (diff) | |
download | iceauth-0022cf7baf11bccea0024d0dc8c1ecc37e46ef3d.tar.gz |
Bug 10739: iceauth dumps core if signal caught before initialization done
X.Org Bugzilla #10739 <http://bugs.freedesktop.org/show_bug.cgi?id=10739>
Adding a test for NULL filename before calling IceUnlockAuthFile in
auth_finalize cleared the crash, but left the lock file behind.
Moving the initialization of authfilename to earlier in auth_initialize()
allowed the locks to be cleaned up as well.
-rw-r--r-- | process.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -575,6 +575,8 @@ int auth_initialize (authfilename) authfilename); } + iceauth_filename = strdup(authfilename); + if (ignore_locks) { if (break_locks) IceUnlockAuthFile (authfilename); } else { @@ -633,9 +635,6 @@ int auth_initialize (authfilename) iceauth_head = head; } - n = strlen (authfilename); - iceauth_filename = malloc (n + 1); - if (iceauth_filename) strcpy (iceauth_filename, authfilename); iceauth_modified = False; if (verbose) { @@ -723,7 +722,7 @@ int auth_finalize () } } - if (!ignore_locks) { + if (!ignore_locks && (iceauth_filename != NULL)) { IceUnlockAuthFile (iceauth_filename); } (void) umask (original_umask); |