]> 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)
ext/standard/dl.c

index f1a2462c4b3bc35acb05bfb785f4e49b0983946c..a9579a041865443f06fd4498f7e23702ad391b57 100644 (file)
@@ -139,8 +139,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;
        }