]> granicus.if.org Git - php/commitdiff
- fix leak in DL on error (windows)
authorPierre Joye <pajoye@php.net>
Wed, 21 Oct 2009 06:42:08 +0000 (06:42 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 21 Oct 2009 06:42:08 +0000 (06:42 +0000)
NEWS
ext/standard/dl.c

diff --git a/NEWS b/NEWS
index 34be2a38c53ee1d194f46cab8dc8b95a5b304661..65d7df6bdba12747f6a2ab0c99634c5336c72950 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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).
index 5119bf4163f3307d4a0a66b88cb9132552014e25..ebd626a48f1c6144e113380f1d88e0181df1d112 100644 (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;
        }