mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 21:05:08 +00:00
Plug a memory leak.
This commit is contained in:
parent
a559a5a94f
commit
1bf9e66cbc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252514
|
@ -491,6 +491,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
|
||||||
if (!qflag)
|
if (!qflag)
|
||||||
warnx("%s: Device already in use",
|
warnx("%s: Device already in use",
|
||||||
vnodefile);
|
vnodefile);
|
||||||
|
free(vnodefile);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
error = run_cmd(&fd, "%s -a -t vnode -n -f %s",
|
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) {
|
if (error) {
|
||||||
warnx("mdconfig (attach) error: file=%s",
|
warnx("mdconfig (attach) error: file=%s",
|
||||||
vnodefile);
|
vnodefile);
|
||||||
|
free(vnodefile);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
sfd = fdopen(fd, "r");
|
sfd = fdopen(fd, "r");
|
||||||
|
@ -537,6 +539,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
|
||||||
if (!qflag)
|
if (!qflag)
|
||||||
warnx("md%d on %s: Device already "
|
warnx("md%d on %s: Device already "
|
||||||
"in use", mdunit, vnodefile);
|
"in use", mdunit, vnodefile);
|
||||||
|
free(vnodefile);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
error = run_cmd(NULL, "%s -a -t vnode -u %d -f %s",
|
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) {
|
if (error) {
|
||||||
warnx("mdconfig (attach) error: "
|
warnx("mdconfig (attach) error: "
|
||||||
"md%d on file=%s", mdunit, vnodefile);
|
"md%d on file=%s", mdunit, vnodefile);
|
||||||
|
free(vnodefile);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -557,6 +561,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
|
||||||
if (!qflag)
|
if (!qflag)
|
||||||
warnx("md on %s: Device not found",
|
warnx("md on %s: Device not found",
|
||||||
vnodefile);
|
vnodefile);
|
||||||
|
free(vnodefile);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
sfd = fdopen(fd, "r");
|
sfd = fdopen(fd, "r");
|
||||||
|
@ -599,6 +604,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
|
||||||
if (!qflag)
|
if (!qflag)
|
||||||
warnx("md%d on %s: Device not found",
|
warnx("md%d on %s: Device not found",
|
||||||
mdunit, vnodefile);
|
mdunit, vnodefile);
|
||||||
|
free(vnodefile);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -622,6 +628,7 @@ swap_on_off_md(const char *name, char *mntops, int doingall)
|
||||||
fclose(sfd);
|
fclose(sfd);
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
close(fd);
|
close(fd);
|
||||||
|
free(vnodefile);
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue