From: Wez Furlong Date: Mon, 26 May 2003 19:01:45 +0000 (+0000) Subject: Plug a leak - noticed by Ilia. X-Git-Tag: php-4.3.2RC4~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53035874943ef49f45a72aba46d7d66b6a97d6c3;p=php Plug a leak - noticed by Ilia. --- diff --git a/ext/standard/file.c b/ext/standard/file.c index 4bbf1ce459..489c96074c 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -415,7 +415,7 @@ PHP_FUNCTION(file_get_contents) { char *filename; int filename_len; - char *contents; + char *contents = NULL; zend_bool use_include_path = 0; php_stream *stream; int len, newlen; @@ -441,12 +441,17 @@ PHP_FUNCTION(file_get_contents) } RETVAL_STRINGL(contents, len, 0); + contents = NULL; } else if (len == 0) { RETVAL_EMPTY_STRING(); } else { RETVAL_FALSE; } + if (contents) { + efree(contents); + } + php_stream_close(stream); }