- fix leak in DL on error (windows)

This commit is contained in:
Pierre Joye 2009-10-21 06:42:08 +00:00
parent 8df115c25e
commit 26270b4fd7
2 changed files with 13 additions and 0 deletions

3
NEWS
View File

@ -8,6 +8,9 @@ PHP NEWS
- Implemented FR #49253 (added support for libcurl's CERTINFO option).
(Linus Nielsen Feltzing <linus@haxx.se>)
- Fixed memory leak in extension loading when an error occurs on Windows.
(Pierre)
- Fixed bug #49855 (import_request_variables() always returns NULL). (Ilia,
sjoerd at php dot net)
- Fixed bug #49800 (SimpleXML allow (un)serialize() calls without warning).

View File

@ -146,8 +146,18 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now TSRMLS_DC)
/* load dynamic symbol */
handle = DL_LOAD(libpath);
if (!handle) {
#if PHP_WIN32
char *err = GET_DL_ERROR();
if (err) {
php_error_docref(NULL TSRMLS_CC, error_type, "Unable to load dynamic library '%s' - %s", libpath, err);
LocalFree(err);
} else {
php_error_docref(NULL TSRMLS_CC, error_type, "Unable to load dynamic library '%s' - %s", libpath, "Unknown reason");
}
#else
php_error_docref(NULL TSRMLS_CC, error_type, "Unable to load dynamic library '%s' - %s", libpath, GET_DL_ERROR());
GET_DL_ERROR(); /* free the buffer storing the error */
#endif
efree(libpath);
return FAILURE;
}