Fix a memory management issue that leads to crashes in OpenSSL.crypto.X509.get_serial_number in some environments.
diff --git a/ChangeLog b/ChangeLog
index 12cd8b6..9fe65c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-10-03 Christian Heimes <christian@python.org>
+
+ * OpenSSL/crypto/x509.c: Fix an inconsistency in memory management
+ in X509.get_serial_number which leads to crashes on some runtimes
+ (certain Windows/Python 3.3 environments, at least).
+
2013-08-11 Christian Heimes <christian@python.org>
* OpenSSL/crypto/x509ext.c: Fix handling of NULL bytes inside
diff --git a/OpenSSL/crypto/x509.c b/OpenSSL/crypto/x509.c
index 8ee4bff..9a4fe94 100644
--- a/OpenSSL/crypto/x509.c
+++ b/OpenSSL/crypto/x509.c
@@ -78,7 +78,7 @@
hex = BN_bn2hex(bignum);
res = PyLong_FromString(hex, NULL, 16);
BN_free(bignum);
- free(hex);
+ OPENSSL_free(hex);
return res;
}