status |= wait_many(FLAG_WAIT_ALL);
free(fsck_path);
mnt_unref_cache(mntcache);
- mnt_free_table(fstab);
- mnt_free_table(mtab);
+ mnt_unref_table(fstab);
+ mnt_unref_table(mtab);
return status;
}
break;
}
if (rc) {
- mnt_free_table(tb);
+ mnt_unref_table(tb);
warn(_("can't read %s"), path);
return NULL;
}
rc = 0;
done:
- mnt_free_table(tb_new);
+ mnt_unref_table(tb_new);
mnt_free_tabdiff(diff);
mnt_free_iter(itr);
if (f)
leave:
tt_free_table(tt);
- mnt_free_table(tb);
+ mnt_unref_table(tb);
mnt_unref_cache(cache);
+
free(tabfiles);
#ifdef HAVE_LIBUDEV
udev_unref(udev);
leave:
tt_free_table(lsblk->tt);
- mnt_free_table(mtab);
- mnt_free_table(swaps);
+
+ mnt_unref_table(mtab);
+ mnt_unref_table(swaps);
mnt_unref_cache(mntcache);
#ifdef HAVE_LIBUDEV
udev_unref(udev);
if (!rc && !list_empty(&locks))
rc = show_locks(&locks, tt_flags);
- mnt_free_table(tab);
+ mnt_unref_table(tab);
return rc;
}
static long int x_arg;
struct libmnt_table *mtab;
-struct libmnt_cache *cache;
static void vinfo(const char *fmt, va_list va)
{
*mnt = NULL;
if (!mtab) {
+ struct libmnt_cache *cache;
+
mtab = mnt_new_table();
if (!mtab)
err(EXIT_FAILURE, _("failed to initialize libmount table"));
- if (!cache)
- cache = mnt_new_cache();
+ cache = mnt_new_cache();
mnt_table_set_cache(mtab, cache);
+ mnt_unref_cache(cache);
if (p_option)
rc = mnt_table_parse_file(mtab, _PATH_PROC_MOUNTINFO);
free(device);
free(mountpoint);
- mnt_free_table(mtab);
- mnt_unref_cache(cache);
+ mnt_unref_table(mtab);
return EXIT_SUCCESS;
}
mnt_table_set_parser_errcb(fstab, table_parser_errcb);
mnt_context_set_fstab(cxt, fstab);
+
+ mnt_unref_table(fstab); /* reference is handled by @cxt now */
}
if (mnt_table_parse_fstab(fstab, path))
success_message(cxt);
done:
mnt_free_context(cxt);
- mnt_free_table(fstab);
return rc;
}
rc = 0;
}
- mnt_free_table(tb);
+ mnt_unref_table(tb);
return rc;
}
void free_tables(void)
{
- mnt_free_table(swaps);
- mnt_free_table(fstab);
+ mnt_unref_table(swaps);
+ mnt_unref_table(fstab);
}
int match_swap(struct libmnt_fs *fs, void *data __attribute__((unused)))
if (mnt_table_parse_file(tb, _PATH_PROC_MOUNTINFO)) {
warn(_("failed to parse %s"), _PATH_PROC_MOUNTINFO);
- mnt_free_table(tb);
+ mnt_unref_table(tb);
tb = NULL;
}
_("%s: not found"), spec);
}
- mnt_free_table(tb);
+ mnt_unref_table(tb);
return rc;
}
}
mnt_free_iter(itr);
- mnt_free_table(tb);
+ mnt_unref_table(tb);
return rc;
}