summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/boot/sys/boot/common/boot.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr/src/boot/sys/boot/common/boot.c b/usr/src/boot/sys/boot/common/boot.c
index 2f6b7f1f78..349fa5f9e8 100644
--- a/usr/src/boot/sys/boot/common/boot.c
+++ b/usr/src/boot/sys/boot/common/boot.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
* All rights reserved.
*
@@ -25,7 +25,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
/*
* Loading modules, booting the system
@@ -307,6 +306,8 @@ getrootmount(char *rootdev)
goto notfound;
/* loop reading lines from /etc/fstab What was that about sscanf again? */
+ fstyp = NULL;
+ dev = NULL;
while (fgetstr(lbuf, sizeof(lbuf), fd) >= 0) {
if ((lbuf[0] == 0) || (lbuf[0] == '#'))
continue;
@@ -318,6 +319,7 @@ getrootmount(char *rootdev)
continue;
/* delimit and save */
*cp++ = 0;
+ free(dev);
dev = strdup(lbuf);
/* skip whitespace up to mountpoint */
@@ -337,6 +339,7 @@ getrootmount(char *rootdev)
while ((*cp != 0) && !isspace(*cp))
cp++;
*cp = 0;
+ free(fstyp);
fstyp = strdup(ep);
/* skip whitespace up to mount options */
@@ -353,8 +356,6 @@ getrootmount(char *rootdev)
options = strdup(ep);
/* Build the <fstype>:<device> and save it in vfs.root.mountfrom */
sprintf(lbuf, "%s:%s", fstyp, dev);
- free(dev);
- free(fstyp);
setenv("vfs.root.mountfrom", lbuf, 0);
/* Don't override vfs.root.mountfrom.options if it is already set */
@@ -367,6 +368,8 @@ getrootmount(char *rootdev)
break;
}
close(fd);
+ free(dev);
+ free(fstyp);
notfound:
if (error) {
@@ -378,6 +381,7 @@ notfound:
cp[strlen(cp) - 1] = '\0';
setenv("vfs.root.mountfrom", cp, 0);
error = 0;
+ free(cp);
}
}