]> granicus.if.org Git - php/commitdiff
Fix segfault for scripts like this:
authorWez Furlong <wez@php.net>
Tue, 27 Jan 2004 22:40:44 +0000 (22:40 +0000)
committerWez Furlong <wez@php.net>
Tue, 27 Jan 2004 22:40:44 +0000 (22:40 +0000)
<?php
pfsockopen("foo");
pfsockopen("foo");
?>
Where the transport fails to connect (since args are bogus);
the problem was that the persistent stream entry was not
correctly freed.

main/streams/transports.c

index 5b2c0d89bb4d259e076999a4ab58652f3229be99..1c20026655e29e732987c90a293748a67e2ff996 100644 (file)
@@ -163,7 +163,11 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, long namelen, int
 
        if (failed) {
                /* failure means that they don't get a stream to play with */
-               php_stream_close(stream);
+               if (persistent_id) {
+                       php_stream_pclose(stream);
+               } else {
+                       php_stream_close(stream);
+               }
                stream = NULL;
        }