summaryrefslogtreecommitdiffstats
path: root/sys-utils/swapoff.c
diff options
context:
space:
mode:
authorKarel Zak2016-10-05 11:20:26 +0200
committerKarel Zak2016-10-05 11:20:26 +0200
commiteeea7ef59035f22e049b2cb1b295f44ef7e236ea (patch)
tree9efff14b4b748e6166c39c5ce32e0b030f4dd139 /sys-utils/swapoff.c
parentsetarch: let's keep analyzer happy [coverity scan] (diff)
downloadkernel-qcow2-util-linux-eeea7ef59035f22e049b2cb1b295f44ef7e236ea.tar.gz
kernel-qcow2-util-linux-eeea7ef59035f22e049b2cb1b295f44ef7e236ea.tar.xz
kernel-qcow2-util-linux-eeea7ef59035f22e049b2cb1b295f44ef7e236ea.zip
swapoff: fix mem leak [coverity scan]
Diffstat (limited to 'sys-utils/swapoff.c')
-rw-r--r--sys-utils/swapoff.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys-utils/swapoff.c b/sys-utils/swapoff.c
index 562b24f33..dd3bf05fc 100644
--- a/sys-utils/swapoff.c
+++ b/sys-utils/swapoff.c
@@ -89,8 +89,11 @@ static int do_swapoff(const char *orig_special, int quiet, int canonic)
char *n, *v;
special = mnt_resolve_spec(orig_special, mntcache);
- if (!special && blkid_parse_tag_string(orig_special, &n, &v) == 0)
+ if (!special && blkid_parse_tag_string(orig_special, &n, &v) == 0) {
special = swapoff_resolve_tag(n, v, mntcache);
+ free(n);
+ free(v);
+ }
if (!special)
return cannot_find(orig_special);
}