From a4f9c8efc2c848da1420bf6b34451ecae19c41d0 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Sun, 19 Mar 2006 22:34:26 +0000 Subject: [PATCH] MFB: first check stream for NULL, then dereference --- main/network.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/network.c b/main/network.c index 69b0f9f094..6785242b2a 100644 --- a/main/network.c +++ b/main/network.c @@ -988,10 +988,12 @@ PHPAPI php_stream *_php_stream_sock_open_from_socket(php_socket_t socket, const sock->socket = socket; stream = php_stream_alloc_rel(&php_stream_generic_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; } -- 2.40.0