diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 877ca463e..0a49207b8 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,10 @@ +2004-08-24 Roland Illig + + * extfs.c (extfs_internal_stat): Fixed memory leaks introduced + by my change from 2004-08-16. (extfs_unlink): likewise. + + * ftpfs.c (ftpfs_send_command): likewise. + 2004-08-21 Pavel S. Shirshov * extfs/urar.in: Fix non-POSIX constructs. diff --git a/vfs/extfs.c b/vfs/extfs.c index 2c801f2f4..0b7847e78 100644 --- a/vfs/extfs.c +++ b/vfs/extfs.c @@ -937,17 +937,21 @@ static int extfs_internal_stat (const char *path, struct stat *buf, int resolve) struct entry *entry; struct inode *inode; char *path2 = g_strdup(path); + int result = -1; if ((q = extfs_get_path_mangle (path2, &archive, 0, 0)) == NULL) - return -1; + goto cleanup; entry = extfs_find_entry (archive->root_entry, q, 0, 0); if (entry == NULL) - return -1; + goto cleanup; if (resolve && (entry = extfs_resolve_symlinks (entry)) == NULL) - return -1; + goto cleanup; inode = entry->inode; extfs_stat_move( buf, inode ); - return 0; + result = 0; +cleanup: + g_free (path2); + return result; } static int extfs_stat (struct vfs_class *me, const char *path, struct stat *buf) @@ -1032,6 +1036,7 @@ static int extfs_unlink (struct vfs_class *me, const char *file) } if (extfs_cmd (" rm ", archive, entry, "")){ my_errno = EIO; + goto cleanup; } extfs_remove_entry (entry); result = 0; diff --git a/vfs/ftpfs.c b/vfs/ftpfs.c index 1f9a892c0..a84905b47 100644 --- a/vfs/ftpfs.c +++ b/vfs/ftpfs.c @@ -1460,8 +1460,11 @@ ftpfs_send_command(struct vfs_class *me, const char *filename, const char *cmd, vfs_stamp_create (&vfs_ftpfs_ops, super); if (flags & OPT_IGNORE_ERROR) r = COMPLETE; - if (r != COMPLETE) - ERRNOR (EPERM, -1); + if (r != COMPLETE) { + me->verrno = EPERM; + g_free (mpath); + return -1; + } if (flush_directory_cache) vfs_s_invalidate(me, super); g_free(mpath);