File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -391,10 +391,11 @@ py_blake2b_dealloc(PyObject *self)
391391 PyThread_free_lock (obj -> lock );
392392 obj -> lock = NULL ;
393393 }
394- PyTypeObject * tp = Py_TYPE (self );
395- Py_DECREF (tp );
396394
397395 PyObject_Del (self );
396+
397+ PyTypeObject * tp = Py_TYPE (self );
398+ Py_DECREF (tp );
398399}
399400
400401static PyType_Slot blake2b_type_slots [] = {
Original file line number Diff line number Diff line change @@ -37,9 +37,11 @@ static struct PyMethodDef blake2mod_functions[] = {
3737#define ADD_INT (d , name , value ) do { \
3838 PyObject *x = PyLong_FromLong(value); \
3939 if (!x) { \
40+ Py_DECREF(x); \
4041 return -1; \
4142 } \
4243 if (PyDict_SetItemString(d, name, x) < 0) { \
44+ Py_DECREF(x); \
4345 return -1; \
4446 } \
4547 Py_DECREF(x); \
@@ -53,6 +55,8 @@ static int blake2_exec(PyObject *m)
5355 st -> blake2b_type = (PyTypeObject * )PyType_FromModuleAndSpec (
5456 m , & blake2b_type_spec , NULL );
5557
58+ if (NULL == st -> blake2b_type )
59+ return -1 ;
5660 /* BLAKE2b */
5761 if (PyModule_AddType (m , st -> blake2b_type ) < 0 ) {
5862 return -1 ;
@@ -73,6 +77,9 @@ static int blake2_exec(PyObject *m)
7377 st -> blake2s_type = (PyTypeObject * )PyType_FromModuleAndSpec (
7478 m , & blake2s_type_spec , NULL );
7579
80+ if (NULL == st -> blake2s_type )
81+ return -1 ;
82+
7683 if (PyModule_AddType (m , st -> blake2s_type ) < 0 ) {
7784 return -1 ;
7885 }
Original file line number Diff line number Diff line change @@ -391,10 +391,10 @@ py_blake2s_dealloc(PyObject *self)
391391 obj -> lock = NULL ;
392392 }
393393
394+ PyObject_Del (self );
395+
394396 PyTypeObject * tp = Py_TYPE (self );
395397 Py_DECREF (tp );
396-
397- PyObject_Del (self );
398398}
399399
400400static PyType_Slot blake2s_type_slots [] = {
You can’t perform that action at this time.
0 commit comments