From 38483d894e0d464b0cb9a358742ca63f6ea57b00 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 1 Feb 2011 22:16:05 +0100 Subject: [PATCH] Added missing iso_filesystem_ref() for cloned node from local filesystem. --- libisofs/fs_image.c | 4 ++-- libisofs/fs_local.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libisofs/fs_image.c b/libisofs/fs_image.c index dd5984e..6e737c0 100644 --- a/libisofs/fs_image.c +++ b/libisofs/fs_image.c @@ -1081,10 +1081,8 @@ int ifs_clone_src(IsoFileSource *old_source, goto no_mem; new_data->fs = old_data->fs; - iso_filesystem_ref(new_data->fs); new_data->parent = old_data->parent; - iso_file_source_ref(new_data->parent); memcpy(&(new_data->info), &(old_data->info), sizeof(struct stat)); new_data->name = new_name; @@ -1106,6 +1104,8 @@ int ifs_clone_src(IsoFileSource *old_source, src->refcount = 1; src->data = new_data; *new_source = src; + iso_file_source_ref(new_data->parent); + iso_filesystem_ref(new_data->fs); return ISO_SUCCESS; no_mem:; if (src != NULL) diff --git a/libisofs/fs_local.c b/libisofs/fs_local.c index 63834f5..f90e9c9 100644 --- a/libisofs/fs_local.c +++ b/libisofs/fs_local.c @@ -561,12 +561,14 @@ int lfs_clone_src(IsoFileSource *old_source, new_data->info.fd = -1; /* the value does not matter with (openned == 0) */ new_data->name = new_name; new_data->parent = old_data->parent; - iso_file_source_ref(new_data->parent); src->class = old_source->class; src->refcount = 1; src->data = new_data; *new_source = src; + + iso_file_source_ref(new_data->parent); + iso_filesystem_ref(lfs); return ISO_SUCCESS; no_mem:; if (src != NULL)