aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2007-05-15 20:09:29 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2007-05-15 20:09:29 +0000
commit15f911853e8166ee951810f7dfa75e3f10eb2c68 (patch)
treec9e57aaeffd76b65b61b08815c3cee730403b519
parenteff16314282d683e0b6f6e8abfc0f51091eebce2 (diff)
downloadsshfs-15f911853e8166ee951810f7dfa75e3f10eb2c68.tar
sshfs-15f911853e8166ee951810f7dfa75e3f10eb2c68.tar.gz
sshfs-15f911853e8166ee951810f7dfa75e3f10eb2c68.tar.bz2
sshfs-15f911853e8166ee951810f7dfa75e3f10eb2c68.zip
fixes
-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;