gh-146245: Fix ref/buffer leaks in socketmodule.c on audit hook failure by kimimgo · Pull Request #146247 · python/cpython
Fixes #146245
Summary
Two leak bugs in socketmodule.c when PySys_Audit raises:
1. getaddrinfo (line 6985)
return NULL skipped cleanup of idna and pstr refs. Changed to
goto err which properly calls Py_XDECREF on both.
2. sock_sendto (line 4811)
return NULL skipped PyBuffer_Release(&pbuf). Added the release
before the return, matching the pattern used in adjacent error paths.