From 14104e931e90e224be8139a4a20848cd4001d0ef Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 22 Aug 2013 11:57:06 +0200 Subject: libmount: cleanup libmnt_fs list after mnt_table_remove_fs() .. otherwise mnt_free_fs() will try to remove FS from non-existing list. Signed-off-by: Karel Zak --- libmount/src/fs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libmount/src/fs.c') diff --git a/libmount/src/fs.c b/libmount/src/fs.c index 690428cda..23c873d54 100644 --- a/libmount/src/fs.c +++ b/libmount/src/fs.c @@ -34,6 +34,7 @@ struct libmnt_fs *mnt_new_fs(void) fs->refcount = 1; INIT_LIST_HEAD(&fs->ents); + /*DBG(FS, mnt_debug_h(fs, "alloc"));*/ return fs; } @@ -89,6 +90,7 @@ void mnt_reset_fs(struct libmnt_fs *fs) ref = fs->refcount; memset(fs, 0, sizeof(*fs)); + INIT_LIST_HEAD(&fs->ents); fs->refcount = ref; } @@ -295,7 +297,12 @@ err: void *mnt_fs_get_userdata(struct libmnt_fs *fs) { assert(fs); - return fs ? fs->userdata : NULL; + + if (!fs) + return NULL; + + /*DBG(FS, mnt_debug_h(fs, "get userdata [%p]", fs->userdata));*/ + return fs->userdata; } /** @@ -312,6 +319,8 @@ int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data) assert(fs); if (!fs) return -EINVAL; + + /*DBG(FS, mnt_debug_h(fs, "set userdata [%p]", fs->userdata));*/ fs->userdata = data; return 0; } -- cgit v1.2.3-55-g7522