summaryrefslogtreecommitdiff
path: root/main/network.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-03-19 22:33:10 +0000
committerAntony Dovgal <tony2001@php.net>2006-03-19 22:33:10 +0000
commitef1f36e2c1d0913ab1708999775b6ffe8aca2896 (patch)
tree4cb043383f9073a80f067f552ed5dcbe8d58262d /main/network.c
parent90d7fbe798df851b50ed7dc3d7b6e9ad0d2560bb (diff)
downloadphp-git-ef1f36e2c1d0913ab1708999775b6ffe8aca2896.tar.gz
first check stream for NULL, then dereference
Diffstat (limited to 'main/network.c')
-rw-r--r--main/network.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/network.c b/main/network.c
index 195a825180..15fa5aad97 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;
}