summaryrefslogtreecommitdiffstats
path: root/disk-utils/fsck.c
diff options
context:
space:
mode:
authorKarel Zak2015-01-28 14:45:15 +0100
committerKarel Zak2015-01-28 14:45:15 +0100
commit52c56476ae5014d6e9293e5bf3d75b230a20b4cc (patch)
tree4a31d1f397e3763db8338fde5a472daac2481fdf /disk-utils/fsck.c
parentfdisk: check return and robust label usage [coverity scan] (diff)
downloadkernel-qcow2-util-linux-52c56476ae5014d6e9293e5bf3d75b230a20b4cc.tar.gz
kernel-qcow2-util-linux-52c56476ae5014d6e9293e5bf3d75b230a20b4cc.tar.xz
kernel-qcow2-util-linux-52c56476ae5014d6e9293e5bf3d75b230a20b4cc.zip
fsck: deallocate when no cache [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/fsck.c')
-rw-r--r--disk-utils/fsck.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c
index 535184e81..277d04105 100644
--- a/disk-utils/fsck.c
+++ b/disk-utils/fsck.c
@@ -450,10 +450,14 @@ static void fs_interpret_type(struct libmnt_fs *fs)
device = fs_get_device(fs);
if (device) {
int ambi = 0;
+ char *tp;
+ struct libmnt_cache *cache = mnt_table_get_cache(fstab);
- type = mnt_get_fstype(device, &ambi, mnt_table_get_cache(fstab));
+ tp = mnt_get_fstype(device, &ambi, cache);
if (!ambi)
- mnt_fs_set_fstype(fs, type);
+ mnt_fs_set_fstype(fs, tp);
+ if (!cache)
+ free(tp);
}
}