]> granicus.if.org Git - php/commitdiff
Fix a little leak.
authorWez Furlong <wez@php.net>
Fri, 16 Aug 2002 12:02:42 +0000 (12:02 +0000)
committerWez Furlong <wez@php.net>
Fri, 16 Aug 2002 12:02:42 +0000 (12:02 +0000)
main/streams.c

index f6e6229fba8ee7b91977e54c672203de35be3fe2..3b05145043c4450bbda0b5bb5f39dafe33915932 100755 (executable)
@@ -1366,6 +1366,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
        if (stream == NULL && (options & REPORT_ERRORS)) {
                char *tmp = estrdup(path);
                char *msg;
+               int free_msg = 0;
 
                if (wrapper) {
                        if (wrapper->err_count) {
@@ -1395,6 +1396,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
                                                strcat(msg, br);
                                }
                                
+                               free_msg = 1;
                        } else {
                                msg = strerror(errno);
                        }
@@ -1405,6 +1407,8 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(char *path, char *mode, int optio
                php_strip_url_passwd(tmp);
                php_error_docref1(NULL TSRMLS_CC, tmp, E_WARNING, "failed to create stream: %s", msg);
                efree(tmp);
+               if (free_msg)
+                       efree(msg);
        }
        if (wrapper) {
                /* tidy up the error stack */