fix memory leak on thread creation failure...

This commit is contained in:
Miklos Szeredi 2007-05-24 18:51:08 +00:00
parent ea21aafdb9
commit a13323d10b
3 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2007-05-24 Miklos Szeredi <miklos@szeredi.hu>
* lib: fix memory leak on thread creation failure in multithreaded
event loop. Found by Chris AtLee
* Filesystems (e.g. sshfs) failed to exit if SIGHUP handler is
SIG_IGN in the parent process. So install handler for SIGHUP even
in this case. Reported by Tim Walberg
2007-05-21 Miklos Szeredi <miklos@szeredi.hu>
* Fix Oops or error if a regular file is created with mknod(2) on

View File

@ -143,6 +143,8 @@ static int fuse_start_thread(struct fuse_mt *mt)
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
if (res != 0) {
fprintf(stderr, "fuse: error creating thread: %s\n", strerror(res));
free(w->buf);
free(w);
return -1;
}
list_add_worker(w, &mt->main);

View File

@ -36,7 +36,8 @@ static int set_one_signal_handler(int sig, void (*handler)(int))
return -1;
}
if (old_sa.sa_handler == SIG_DFL &&
if ((old_sa.sa_handler == SIG_DFL ||
(sig == SIGHUP && old_sa.sa_handler == SIG_IGN)) &&
sigaction(sig, &sa, NULL) == -1) {
perror("fuse: cannot set signal handler");
return -1;