diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_hashopenssl.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c index 9091025..aae558c 100644 --- a/Modules/_hashopenssl.c +++ b/Modules/_hashopenssl.c @@ -109,17 +109,18 @@ newEVPobject(PyObject *name) return NULL; } + /* save the name for .name to return */ + Py_INCREF(name); + retval->name = name; + retval->lock = NULL; + retval->ctx = EVP_MD_CTX_new(); if (retval->ctx == NULL) { + Py_DECREF(retval); PyErr_NoMemory(); return NULL; } - /* save the name for .name to return */ - Py_INCREF(name); - retval->name = name; - retval->lock = NULL; - return retval; } @@ -182,6 +183,7 @@ EVP_copy_impl(EVPobject *self) return NULL; if (!locked_EVP_MD_CTX_copy(newobj->ctx, self)) { + Py_DECREF(newobj); return _setException(PyExc_ValueError); } return (PyObject *)newobj; |