https://gitlab.synchro.net/main/sbbs/-/commit/9816527184efa37027df73d0
Modified Files:
src/tith/GNUmakefile base64.c nodelist.c tith-client.c tith-common.c tith-common.h tith-config.c tith-config.h tith-file.c tith-file.h tith-server.c tith.c tith.h
Log Message:
Fix up alloc/free usage
Since this is being designed so it can be used by third-party software,
and since we no longer call exit() on errors, we need to actually
free all memory that we allocate... we can't just bail and let the
OS clean it up.
So, the current command and the config are now thread-local globals
which are automatically clean up on termination, and ephemeral allocs
now go onto a thread-local stack.
You need to pushAlloc() anything that's allocated (which checks if
the allocation failed), then popAlloc() when the value is free()d
or returned.
With that, we can clean up all the allocations and longjmp() out
on errors.
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net