mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Replace an alloca() call with a slightly more standard malloc()/free()
pair.
This commit is contained in:
parent
7d8b5aa2c1
commit
0cd41dca9a
1 changed files with 8 additions and 3 deletions
|
|
@ -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 a new issue