diff options
author | Karel Zak | 2012-12-12 12:40:48 +0100 |
---|---|---|
committer | Karel Zak | 2012-12-12 12:40:48 +0100 |
commit | 880f09c828cd5b29d65a71b9a5337568236b3207 (patch) | |
tree | df7b66b155527f50c0ab1092cfeb8c38eed13dde /sys-utils/swapon.c | |
parent | libblkid: check mkdir(/run/blkid) return code [coverity scan] (diff) | |
download | kernel-qcow2-util-linux-880f09c828cd5b29d65a71b9a5337568236b3207.tar.gz kernel-qcow2-util-linux-880f09c828cd5b29d65a71b9a5337568236b3207.tar.xz kernel-qcow2-util-linux-880f09c828cd5b29d65a71b9a5337568236b3207.zip |
swapon: fix memmory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/swapon.c')
-rw-r--r-- | sys-utils/swapon.c | 8 |
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; } |