The buffer that receives a listener's address on behalf of a newly
accepted socket was allocated by unp_connectat() and passed down as
struct sockaddr **sap, to be consumed -- signalled by storing NULL
through it -- or else freed by the caller. Only unp_connect_peer()
ever looks at it.
The intent was fine enough -- there is some locking around the place
where the buffer is actually written to, so it must be allocated in
advance. However, the malloc was simply occurring way too far in
advance for no reason, and especially after the little functions were
recently split out, this resulted in needless spaghetti.
Allocate it in the function that needs it instead, avoiding an extra
parameter and making it a purely local resource allocated and freed
within the same function.
No functional change intended.
Signed-off-by: John Ericson <John.Ericson@Obsidian.Systems>
Assisted-by: Claude Code (Claude Opus 5)