From: Wez Furlong Date: Fri, 16 Aug 2002 12:02:42 +0000 (+0000) Subject: Fix a little leak. X-Git-Tag: php-4.3.0dev_zend2_alpha3~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e4b6ef181934b893001723f3cbec091d23e9bbd;p=php Fix a little leak. --- diff --git a/main/streams.c b/main/streams.c index f6e6229fba..3b05145043 100755 --- a/main/streams.c +++ b/main/streams.c @@ -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 */