aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--configure.ac2
-rw-r--r--sshfs.c9
3 files changed, 15 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e4a3727..88519c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-05-15 Miklos Szeredi <miklos@szeredi.hu>
+
+ * 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 <miklos@szeredi.hu>
* Fix crash within gdb, caused by sem_wait() returning with an
diff --git a/configure.ac b/configure.ac
index 37601aa..01dfc4e 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 b20d6e1..cc168da 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;