Commit 2f90addb authored by Alex Chernyakhovsky's avatar Alex Chernyakhovsky Committed by Alex Chernyakhovsky
Browse files

Revert "Remove redundant malloc/free"

This reverts commit 6321b1d9.

The original commit 6321b1d9 switched
from a malloc call of a 22400 byte buffer to a stack-allocated 22400
byte buffer, in addition to the fairly large buffers already allocated
in the functions. Some systems have fairly small stack frames, making
this 22K allocation potentially dangerous. On my stock Debian bullseye
system, I have 200809 bytes (from `getconf
_POSIX_THREAD_ATTR_STACKSIZE`); a 22400 byte buffer already represents
about 10% of the available stacksize.

Other systems, such as those with musl libc, may have either 80KiB or
128KiB [1], making this allocation represent between 18% to 28% of the
available stack space.

[1] https://wiki.musl-libc.org/functional-differences-from-glibc.html#Thread-stack-size
parent adb62e97
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment