summaryrefslogtreecommitdiffstats
path: root/libmount/src/tab_parse.c
diff options
context:
space:
mode:
authorKarel Zak2013-08-21 12:31:43 +0200
committerKarel Zak2013-08-21 12:48:42 +0200
commit26d0c0aefde9a94f29d9850514fcbcf638eb8728 (patch)
treecfe01b73d0d399baeeb5bdf1ffb8e6cdd6a38708 /libmount/src/tab_parse.c
parentpylibmount: remove Context_get_table() (diff)
downloadkernel-qcow2-util-linux-26d0c0aefde9a94f29d9850514fcbcf638eb8728.tar.gz
kernel-qcow2-util-linux-26d0c0aefde9a94f29d9850514fcbcf638eb8728.tar.xz
kernel-qcow2-util-linux-26d0c0aefde9a94f29d9850514fcbcf638eb8728.zip
libmount: add reference counting to libmount_fs
* mnt_new_fs() returns object with refcount=1 * mnt_free_fs() does not care about reference counter * new functions mnt_ref_fs() and mnt_unref_fs() * mnt_table_add_fs() and mnt_table_rem_fs() uses reference counter * libmmnt_context uses reference counter for internal FS (as it could be shared outside the context) * backwardly incompatible change: - FS could be deallocated after mnt_table_remove_fs() * it's recommended to use mnt_unref_fs() after mnt_table_add_fs() Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab_parse.c')
-rw-r--r--libmount/src/tab_parse.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
index 24e84457e..e31dac8c2 100644
--- a/libmount/src/tab_parse.c
+++ b/libmount/src/tab_parse.c
@@ -630,8 +630,9 @@ int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, const char *filenam
if (rc == 0 && tb->fmt == MNT_FMT_MOUNTINFO)
rc = kernel_fs_postparse(tb, fs, &tid, filename);
}
+ mnt_unref_fs(fs);
+
if (rc) {
- mnt_free_fs(fs);
if (rc == 1)
continue; /* recoverable error */
if (feof(f))