Replace an alloca() call with a slightly more standard malloc()/free()
pair.
This commit is contained in:
parent
7d8b5aa2c1
commit
0cd41dca9a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117843
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user