From 15f911853e8166ee951810f7dfa75e3f10eb2c68 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 15 May 2007 20:09:29 +0000 Subject: [PATCH] fixes --- ChangeLog | 7 +++++++ configure.ac | 2 +- sshfs.c | 9 +++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e4a3727c..88519c2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-05-15 Miklos Szeredi + + * Add needed g_thread_init() to fix rare crashes. Reported by + Dimitrios Apostolou + + * Fix memory leak in sshfs_open_common() + 2007-04-18 Miklos Szeredi * Fix crash within gdb, caused by sem_wait() returning with an diff --git a/configure.ac b/configure.ac index 37601aa2..01dfc4ee 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ fi AM_CONDITIONAL(SSH_NODELAY_SO, test "$enable_sshnodelay" != "no") export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH -PKG_CHECK_MODULES(SSHFS, [fuse >= 2.2 glib-2.0]) +PKG_CHECK_MODULES(SSHFS, [fuse >= 2.2 glib-2.0 gthread-2.0]) have_fuse_opt_parse=no AC_CHECK_FUNC([fuse_opt_parse], [have_fuse_opt_parse=yes]) if test "$have_fuse_opt_parse" = no; then diff --git a/sshfs.c b/sshfs.c index b20d6e17..cc168da9 100644 --- a/sshfs.c +++ b/sshfs.c @@ -1817,8 +1817,11 @@ static int sshfs_open_common(const char *path, mode_t mode, buf_add_path(&buf, path); err2 = sftp_request(sshfs.follow_symlinks ? SSH_FXP_STAT : SSH_FXP_LSTAT, &buf, SSH_FXP_ATTRS, &outbuf); - if (!err2 && buf_get_attrs(&outbuf, &stbuf, NULL) == -1) - err2 = -EIO; + if (!err2) { + if (buf_get_attrs(&outbuf, &stbuf, NULL) == -1) + err2 = -EIO; + buf_free(&outbuf); + } err = sftp_request_wait(open_req, SSH_FXP_OPEN, SSH_FXP_HANDLE, &sf->handle); if (!err && err2) { @@ -2605,6 +2608,8 @@ int main(int argc, char *argv[]) char *base_path; const char *sftp_server; + g_thread_init(NULL); + sshfs.blksize = 4096; sshfs.max_read = 65536; sshfs.nodelay_workaround = 1;