]> granicus.if.org Git - php/commitdiff
Plug a leak - noticed by Ilia.
authorWez Furlong <wez@php.net>
Mon, 26 May 2003 19:01:45 +0000 (19:01 +0000)
committerWez Furlong <wez@php.net>
Mon, 26 May 2003 19:01:45 +0000 (19:01 +0000)
ext/standard/file.c

index 4bbf1ce459bf6b3dec0a55cabd4ad5f4edf596b3..489c96074cb76898cd5ce2c0a1076848cfc713be 100644 (file)
@@ -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);
        
 }