From b03678348c43797f74a8097933a958cc300609ae Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 2 Jun 2010 15:27:38 +0000 Subject: - fix leak on error in mcrypt_create_iv on windows --- ext/mcrypt/mcrypt.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ext/mcrypt') diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c index 23c8eeb149..b3c711b529 100644 --- a/ext/mcrypt/mcrypt.c +++ b/ext/mcrypt/mcrypt.c @@ -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; } -- cgit v1.2.1