]> granicus.if.org Git - php/commitdiff
first check stream for NULL, then dereference
authorAntony Dovgal <tony2001@php.net>
Sun, 19 Mar 2006 22:33:10 +0000 (22:33 +0000)
committerAntony Dovgal <tony2001@php.net>
Sun, 19 Mar 2006 22:33:10 +0000 (22:33 +0000)
main/network.c

index 195a82518002d4f8717d07eb446e976124bf5386..15fa5aad97d2ca07f724423105c2a6ef1b99a3e5 100644 (file)
@@ -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;
 }