# Memory Leaks in Win32 PHP 5.0.0b4

- Thread: https://externals.io/message/7940
- Original archive: https://news-web.php.net/php.internals/7940
- Started by Michael Sisolak on 2004-02-17T22:36:09+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #7940 — Michael Sisolak — 2004-02-17T22:36:09+00:00

URL: https://externals.io/message/7940#7940

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
