Replace an alloca() call with a slightly more standard malloc()/free()

pair.
This commit is contained in:
Mark Murray 2003-07-21 20:55:37 +00:00
parent 7d8b5aa2c1
commit 0cd41dca9a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117843

View File

@ -148,9 +148,14 @@ do_confstr(const char *name, int key)
if (len == 0) {
printf("undefined\n");
} else {
buf = alloca(len);
confstr(key, buf, len);
printf("%s\n", buf);
buf = malloc(len);
if (buf != NULL) {
confstr(key, buf, len);
printf("%s\n", buf);
free(buf);
}
else
err(EX_OSERR, "malloc: confstr");
}
}