Memory Leaks in Win32 PHP 5.0.0b4

php.internals

Michael Sisolak

22 years ago
I've found two small memory leaks in PHP 5.0.0b4 release when running under Win32 (patches attached). 1) The ISAPI doesn't call sapi_shutdown() so the known_post_content_types hash tables doesn't get freed. 2) In virtual_file_ex (TSRM/tsrm_virtual_cwd.c, line 292) the Win32 API function GetLongPathName() is used to expand the value passed in the path parameter. This code mallocs a new string (called new_path), but then sets the const path function parameter to the new malloc and discards the new_path variable. There is nothing later in the function to ensure that this new malloc is freed. Attached is my take on a fix for this by leaving the new_path variable available so that it can be freed at the end of the function. There may be a cleaner way to do this, but this patch is one approach. Michael Sisolak msisolak@yahoo.com __________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html