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

index 69b0f9f09443406cb62e9157dc73f45f75678ef5..6785242b2a390b183b7adf06514cf3fdd2c15482 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;
 }