]> granicus.if.org Git - php/commitdiff
Fix memleak in debug mode
authorMarcus Boerger <helly@php.net>
Sat, 23 Nov 2002 01:17:39 +0000 (01:17 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 23 Nov 2002 01:17:39 +0000 (01:17 +0000)
main/streams.c

index f18a783471934e1f2d89f0369e71d23bf617a018..5bd0d50c820977ff793d7ad6b29db5a9fbaa671c 100755 (executable)
@@ -2315,7 +2315,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
                                return stream;
                        case PHP_STREAM_RELEASED:
 #if ZEND_DEBUG
-                               newstream->__orig_path = copy_of_path;
+                               newstream->__orig_path = estrdup(path);
 #endif
                                return newstream;
                        default:
@@ -2337,8 +2337,9 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
        }
        tidy_wrapper_error_log(wrapper TSRMLS_CC);
 #if ZEND_DEBUG
-       if (stream == NULL && copy_of_path != NULL)
+       if (stream == NULL && copy_of_path != NULL) {
                efree(copy_of_path);
+       }
 #endif
        return stream;
 }