Author: Armin Rigo <[email protected]>
Branch:
Changeset: r51686:598e02bd0eb8
Date: 2012-01-23 15:34 +0100
http://bitbucket.org/pypy/pypy/changeset/598e02bd0eb8/
Log: Try to be more careful about free()ing this in case something fails.
diff --git a/pypy/module/_hashlib/interp_hashlib.py
b/pypy/module/_hashlib/interp_hashlib.py
--- a/pypy/module/_hashlib/interp_hashlib.py
+++ b/pypy/module/_hashlib/interp_hashlib.py
@@ -34,8 +34,12 @@
ctx = lltype.malloc(ropenssl.EVP_MD_CTX.TO, flavor='raw')
rgc.add_memory_pressure(HASH_MALLOC_SIZE + self.digest_size)
- ropenssl.EVP_DigestInit(ctx, digest_type)
- self.ctx = ctx
+ try:
+ ropenssl.EVP_DigestInit(ctx, digest_type)
+ self.ctx = ctx
+ except:
+ lltype.free(ctx, flavor='raw')
+ raise
def __del__(self):
# self.lock.free()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit