mirror of
https://github.com/php/php-src.git
synced 2026-04-28 18:53:33 +02:00
- fix leak on error in mcrypt_create_iv on windows
This commit is contained in:
@@ -33,6 +33,7 @@ PHP NEWS
|
||||
- Fixed very rare memory leak in mysqlnd, when binding thousands of columns.
|
||||
(Andrey)
|
||||
|
||||
- Fixed memory leak on error in mcrypt_create_iv on Windows. (Pierre)
|
||||
- Fixed a possible crash because of recursive GC invocation. (Dmitry)
|
||||
- Fixed a possible resource destruction issues in shm_put_var()
|
||||
Reported by Stefan Esser (Dmitry)
|
||||
|
||||
@@ -1398,10 +1398,12 @@ PHP_FUNCTION(mcrypt_create_iv)
|
||||
/* It could be done using LoadLibrary but as we rely on 2k+ for 5.3, cleaner to use a clear dependency (Advapi32) and a
|
||||
standard API call (no f=getAddr..; f();) */
|
||||
if(!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
|
||||
efree(iv);
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Cannot open random device");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
if(!CryptGenRandom(hCryptProv, size, iv_b)) {
|
||||
efree(iv);
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Could not gather sufficient random data");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user