From 764cdf2497ac1fe79b4237e9c75d600f7d868351 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Mon, 9 Apr 2012 12:22:51 +0300 Subject: [PATCH] Ticket #2775: segfault after open incorrect archive Signed-off-by: Slava Zanko --- src/vfs/cpio/cpio.c | 1 + src/vfs/tar/tar.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vfs/cpio/cpio.c b/src/vfs/cpio/cpio.c index ffb1dcf47..cf4374972 100644 --- a/src/vfs/cpio/cpio.c +++ b/src/vfs/cpio/cpio.c @@ -257,6 +257,7 @@ cpio_open_cpio_file (struct vfs_class *me, struct vfs_s_super *super, const vfs_ message (D_ERROR, MSG_ERROR, _("Cannot open cpio archive\n%s"), s); g_free (s); g_free (super->name); + super->name = NULL; return -1; } g_free (s); diff --git a/src/vfs/tar/tar.c b/src/vfs/tar/tar.c index 76e7dadf5..7406dbe36 100644 --- a/src/vfs/tar/tar.c +++ b/src/vfs/tar/tar.c @@ -325,6 +325,7 @@ tar_open_archive_int (struct vfs_class *me, const vfs_path_t * vpath, struct vfs if (result == -1) { g_free (archive->name); + archive->name = NULL; ERRNOR (ENOENT, -1); } } @@ -911,7 +912,7 @@ init_tarfs (void) { static struct vfs_s_subclass tarfs_subclass; - tarfs_subclass.flags = VFS_S_READONLY; /* FIXME: tarfs used own temp files */ + tarfs_subclass.flags = VFS_S_READONLY; /* FIXME: tarfs used own temp files */ tarfs_subclass.archive_check = tar_super_check; tarfs_subclass.archive_same = tar_super_same; tarfs_subclass.open_archive = tar_open_archive;