diff options
| author | Jean-Paul Calderone <exarkun@boson> | 2008-02-19 00:43:02 -0500 |
|---|---|---|
| committer | Jean-Paul Calderone <exarkun@boson> | 2008-02-19 00:43:02 -0500 |
| commit | 5b8c5eecc1d3430cea3a47fffb4ef0cc91069d82 (patch) | |
| tree | 78023c372bab5751a80c2e303b68c9c7881b7895 /src | |
| parent | 7b0443a4ba5b74ad8563c2152d767d9b3470819c (diff) | |
| download | pyopenssl-5b8c5eecc1d3430cea3a47fffb4ef0cc91069d82.tar.gz | |
Free the memory allocated by ASN1_STRING_to_UTF8
Diffstat (limited to 'src')
| -rw-r--r-- | src/crypto/x509name.c | 9 |
1 files changed, 6 insertions, 3 deletions
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 @@ crypto_X509Name_getattr(crypto_X509NameObj *self, char *name) 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 @@ crypto_X509Name_setattr(crypto_X509NameObj *self, char *name, PyObject *value) /* 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; |
