summaryrefslogtreecommitdiffstats
path: root/sys-utils/swapon.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys-utils/swapon.c')
-rw-r--r--sys-utils/swapon.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c
index 47ff50816..176be426e 100644
--- a/sys-utils/swapon.c
+++ b/sys-utils/swapon.c
@@ -211,11 +211,11 @@ static int display_summary(void)
static int show_table(int tt_flags, int bytes)
{
struct libmnt_table *st = get_swaps();
- struct libmnt_iter *itr;
+ struct libmnt_iter *itr = NULL;
struct libmnt_fs *fs;
int i, rc = 0;
- struct tt *tt;
+ struct tt *tt = NULL;
if (!st)
return -1;
@@ -227,7 +227,7 @@ static int show_table(int tt_flags, int bytes)
tt = tt_new_table(tt_flags);
if (!tt) {
warn(_("failed to initialize output table"));
- return -1;
+ goto done;
}
for (i = 0; i < ncolumns; i++) {
@@ -243,9 +243,9 @@ static int show_table(int tt_flags, int bytes)
while (mnt_table_next_fs(st, itr, &fs) == 0)
add_tt_line(tt, fs, bytes);
- mnt_free_iter(itr);
tt_print_table(tt);
done:
+ mnt_free_iter(itr);
tt_free_table(tt);
return rc;
}