summaryrefslogtreecommitdiff
path: root/ext/standard/dl.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2009-10-21 06:42:08 +0000
committerPierre Joye <pajoye@php.net>2009-10-21 06:42:08 +0000
commit26270b4fd7e864646fdb77e9fc6da29fcd31d229 (patch)
treeda4a0f91c1df73d6e0a7e290c212a635c149e0a0 /ext/standard/dl.c
parent8df115c25efbdafa70f71ed77f979fc7db2aa3bc (diff)
downloadphp-git-26270b4fd7e864646fdb77e9fc6da29fcd31d229.tar.gz
- fix leak in DL on error (windows)
Diffstat (limited to 'ext/standard/dl.c')
-rw-r--r--ext/standard/dl.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/standard/dl.c b/ext/standard/dl.c
index 5119bf4163..ebd626a48f 100644
--- a/ext/standard/dl.c
+++ b/ext/standard/dl.c
@@ -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;
}