From: Pierre Joye Date: Wed, 21 Oct 2009 06:42:08 +0000 (+0000) Subject: - fix leak in DL on error (windows) X-Git-Tag: php-5.4.0alpha1~191^2~2479 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd60a6eeb6dfe62ed0d3ba303d86121832c5a1c6;p=php - fix leak in DL on error (windows) --- diff --git a/ext/standard/dl.c b/ext/standard/dl.c index f1a2462c4b..a9579a0418 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -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; }