Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
respond to review
  • Loading branch information
koubaa committed Aug 21, 2020
commit 0be5d6ca64badf3832c63702caf42946d1ba56da
5 changes: 3 additions & 2 deletions Modules/_blake2/blake2b_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,11 @@ py_blake2b_dealloc(PyObject *self)
PyThread_free_lock(obj->lock);
obj->lock = NULL;
}
PyTypeObject *tp = Py_TYPE(self);
Py_DECREF(tp);

PyObject_Del(self);

PyTypeObject *tp = Py_TYPE(self);
Py_DECREF(tp);
}

static PyType_Slot blake2b_type_slots[] = {
Expand Down
7 changes: 7 additions & 0 deletions Modules/_blake2/blake2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ static struct PyMethodDef blake2mod_functions[] = {
#define ADD_INT(d, name, value) do { \
PyObject *x = PyLong_FromLong(value); \
if (!x) { \
Py_DECREF(x); \
Comment thread
koubaa marked this conversation as resolved.
Outdated
return -1; \
} \
if (PyDict_SetItemString(d, name, x) < 0) { \
Py_DECREF(x); \
return -1; \
} \
Py_DECREF(x); \
Expand All @@ -53,6 +55,8 @@ static int blake2_exec(PyObject *m)
st->blake2b_type = (PyTypeObject *)PyType_FromModuleAndSpec(
m, &blake2b_type_spec, NULL);

if (NULL == st->blake2b_type)
return -1;
/* BLAKE2b */
if (PyModule_AddType(m, st->blake2b_type) < 0) {
return -1;
Expand All @@ -73,6 +77,9 @@ static int blake2_exec(PyObject *m)
st->blake2s_type = (PyTypeObject *)PyType_FromModuleAndSpec(
m, &blake2s_type_spec, NULL);

if (NULL == st->blake2s_type)
return -1;

if (PyModule_AddType(m, st->blake2s_type) < 0) {
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/_blake2/blake2s_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ py_blake2s_dealloc(PyObject *self)
obj->lock = NULL;
}

PyObject_Del(self);

PyTypeObject *tp = Py_TYPE(self);
Py_DECREF(tp);

PyObject_Del(self);
}

static PyType_Slot blake2s_type_slots[] = {
Expand Down