summaryrefslogtreecommitdiff
path: root/sbin/swapon
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2013-07-02 17:34:34 +0000
committerXin LI <delphij@FreeBSD.org>2013-07-02 17:34:34 +0000
commit1bf9e66cbcba6ac648a6324f76bab3ec8d1990f3 (patch)
tree1b9210e838e96cac68d9593a71e5a8970ce85a4e /sbin/swapon
parenta559a5a94fc7d293c70329b023cd17a19a66978f (diff)
downloadsrc-test2-1bf9e66cbcba6ac648a6324f76bab3ec8d1990f3.tar.gz
src-test2-1bf9e66cbcba6ac648a6324f76bab3ec8d1990f3.zip
Notes
Diffstat (limited to 'sbin/swapon')
-rw-r--r--sbin/swapon/swapon.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c
index b0b43d6c8a06..5dcb18d823a4 100644
--- a/sbin/swapon/swapon.c
+++ b/sbin/swapon/swapon.c
@@ -491,6 +491,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
if (!qflag)
warnx("%s: Device already in use",
vnodefile);
+ free(vnodefile);
return (NULL);
}
error = run_cmd(&fd, "%s -a -t vnode -n -f %s",
@@ -498,6 +499,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
if (error) {
warnx("mdconfig (attach) error: file=%s",
vnodefile);
+ free(vnodefile);
return (NULL);
}
sfd = fdopen(fd, "r");
@@ -537,6 +539,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
if (!qflag)
warnx("md%d on %s: Device already "
"in use", mdunit, vnodefile);
+ free(vnodefile);
return (NULL);
}
error = run_cmd(NULL, "%s -a -t vnode -u %d -f %s",
@@ -544,6 +547,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
if (error) {
warnx("mdconfig (attach) error: "
"md%d on file=%s", mdunit, vnodefile);
+ free(vnodefile);
return (NULL);
}
}
@@ -557,6 +561,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
if (!qflag)
warnx("md on %s: Device not found",
vnodefile);
+ free(vnodefile);
return (NULL);
}
sfd = fdopen(fd, "r");
@@ -599,6 +604,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
if (!qflag)
warnx("md%d on %s: Device not found",
mdunit, vnodefile);
+ free(vnodefile);
return (NULL);
}
}
@@ -622,6 +628,7 @@ err:
fclose(sfd);
if (fd != -1)
close(fd);
+ free(vnodefile);
return (ret);
}