Free the memory allocated by ASN1_STRING_to_UTF8
diff --git a/src/crypto/x509name.c b/src/crypto/x509name.c
index c64b60c..b1c9488 100644
--- a/src/crypto/x509name.c
+++ b/src/crypto/x509name.c
@@ -143,8 +143,11 @@
Py_INCREF(Py_None);
return Py_None;
}
- else
- return PyUnicode_Decode(utf8string, len, "utf-8", NULL);
+ else {
+ PyObject* result = PyUnicode_Decode(utf8string, len, "utf-8", NULL);
+ OPENSSL_free(utf8string);
+ return result;
+ }
}
/*
@@ -170,7 +173,7 @@
/* Something of a hack to get nice unicode behaviour */
if (!PyArg_Parse(value, "es:setattr", "utf-8", &buffer))
return -1;
-
+
result = set_name_by_nid(self->x509_name, nid, buffer);
PyMem_Free(buffer);
return result;