--- php-4.4.4/main/network.c.stream-socket-null-deref 2006-11-02 09:29:54.000000000 -0700 +++ php-4.4.4/main/network.c 2006-11-02 09:32:47.000000000 -0700 @@ -638,10 +638,12 @@ PHPAPI php_stream *_php_stream_sock_open sock->socket = socket; stream = php_stream_alloc_rel(&php_stream_socket_ops, sock, persistent_id, "r+"); - stream->flags |= PHP_STREAM_FLAG_AVOID_BLOCKING; - if (stream == NULL) + if (stream == NULL) { pefree(sock, persistent_id ? 1 : 0); + } else { + stream->flags |= PHP_STREAM_FLAG_AVOID_BLOCKING; + } return stream; }