diff options
Diffstat (limited to 'libmount/src/tab_update.c')
-rw-r--r-- | libmount/src/tab_update.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c index 9603f77ec..b5c92726f 100644 --- a/libmount/src/tab_update.c +++ b/libmount/src/tab_update.c @@ -70,7 +70,7 @@ void mnt_free_update(struct libmnt_update *upd) DBG(UPDATE, mnt_debug_h(upd, "free")); - mnt_free_fs(upd->fs); + mnt_unref_fs(upd->fs); mnt_free_table(upd->mountinfo); free(upd->target); free(upd->filename); @@ -180,7 +180,7 @@ int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags, DBG(UPDATE, mnt_fs_print_debug(fs, stderr)); } - mnt_free_fs(upd->fs); + mnt_unref_fs(upd->fs); free(upd->target); upd->ready = FALSE; upd->fs = NULL; @@ -350,7 +350,7 @@ static int utab_new_entry(struct libmnt_update *upd, struct libmnt_fs *fs, return 0; err: free(u); - mnt_free_fs(upd->fs); + mnt_unref_fs(upd->fs); upd->fs = NULL; return rc; } @@ -671,6 +671,8 @@ static int add_file_entry(struct libmnt_table *tb, struct libmnt_update *upd) return -ENOMEM; mnt_table_add_fs(tb, fs); + mnt_unref_fs(fs); + return update_table(upd, tb); } @@ -722,7 +724,6 @@ static int update_remove_entry(struct libmnt_update *upd, struct libmnt_lock *lc if (rem) { mnt_table_remove_fs(tb, rem); rc = update_table(upd, tb); - mnt_free_fs(rem); } } if (lc) @@ -905,7 +906,7 @@ static int test_add(struct libmnt_test *ts, int argc, char *argv[]) mnt_fs_set_options(fs, argv[4]); rc = update(NULL, fs, 0); - mnt_free_fs(fs); + mnt_unref_fs(fs); return rc; } @@ -928,7 +929,7 @@ static int test_move(struct libmnt_test *ts, int argc, char *argv[]) rc = update(NULL, fs, MS_MOVE); - mnt_free_fs(fs); + mnt_unref_fs(fs); return rc; } @@ -943,7 +944,7 @@ static int test_remount(struct libmnt_test *ts, int argc, char *argv[]) mnt_fs_set_options(fs, argv[2]); rc = update(NULL, fs, MS_REMOUNT); - mnt_free_fs(fs); + mnt_unref_fs(fs); return rc; } @@ -962,7 +963,9 @@ static int test_replace(struct libmnt_test *ts, int argc, char *argv[]) mnt_fs_set_source(fs, argv[1]); mnt_fs_set_target(fs, argv[2]); mnt_fs_append_comment(fs, "# this is new filesystem\n"); + mnt_table_add_fs(tb, fs); + mnt_unref_fs(fs); rc = mnt_table_replace_file(tb, mnt_get_fstab_path()); mnt_free_table(tb); |