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
Please register or sign in to comment