summaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1999-02-01 16:35:40 +0000
committerjkh <jkh@FreeBSD.org>1999-02-01 16:35:40 +0000
commitee4842909ad1e7f621f2f18a1d903e52641221c3 (patch)
treeb543244c8d11eb7bb4a6be0ad8982981a58b3df4 /release
parenta66fe159a89a7ea089f4d8eef24fc04ea7ab7e07 (diff)
downloadFreeBSD-src-ee4842909ad1e7f621f2f18a1d903e52641221c3.zip
FreeBSD-src-ee4842909ad1e7f621f2f18a1d903e52641221c3.tar.gz
Man, was I ever smoking crack when I wrote this. Don't free()
values I'm going to use again. :-}
Diffstat (limited to 'release')
-rw-r--r--release/sysinstall/config.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c
index d661469..59ae131 100644
--- a/release/sysinstall/config.c
+++ b/release/sysinstall/config.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: config.c,v 1.116 1999/01/27 02:32:46 jkh Exp $
+ * $Id: config.c,v 1.117 1999/01/30 22:15:36 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -395,13 +395,11 @@ configRC_conf(char *config)
for (v = VarHead; v; v = v->next) {
for (i = 0; i < nlines; i++) {
/* Skip the comments & non-variable settings */
- if (lines[i][0] == '#' || !(cp = index(lines[i], '='))) {
- free(lines[i]);
+ if (lines[i][0] == '#' || !(cp = index(lines[i], '=')))
continue;
- }
len = strlen(v->name);
- if (!strncmp(lines[i], v->name, cp - lines[i]) && (cp - lines[i]) == len) {
+ if (!strncmp(lines[i], v->name, cp - lines[i]) && (cp - lines[i]) == len && strcmp(cp + 1, v->value)) {
char *cp2, *comment = NULL;
/* If trailing comment, try and preserve it */
@@ -415,7 +413,7 @@ configRC_conf(char *config)
}
}
free(lines[i]);
- lines[i] = (char *)alloca(strlen(v->name) + strlen(v->value) + (comment ? strlen(comment) : 0) + 10);
+ lines[i] = (char *)malloc(strlen(v->name) + strlen(v->value) + (comment ? strlen(comment) : 0) + 10);
if (comment)
sprintf(lines[i], "%s=\"%s\"%s", v->name, v->value, comment);
else
@@ -454,10 +452,10 @@ configRC_conf(char *config)
}
}
}
- else
- free(lines[i]);
}
}
+ for (i = 0; i < nlines; i++)
+ free(lines[i]);
fclose(rcSite);
}
OpenPOWER on IntegriCloud