Commit 1d8cb113ebc for php.net
commit 1d8cb113ebc4c1b386baa7f07e1665f6f10ff910
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date: Sun Jun 7 15:39:11 2026 -0400
sockets: Fix memory leak in socket_recvfrom()
Free recv_buf on the unknown address-family error path, matching the
other switch cases.
Closes GH-22251
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 7be7554d412..7b9b903585b 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -1646,6 +1646,7 @@ PHP_FUNCTION(socket_recvfrom)
*/
#endif
default:
+ zend_string_efree(recv_buf);
zend_argument_value_error(1, "must be one of AF_UNIX, AF_INET, or AF_INET6");
RETURN_THROWS();
}