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)
391
391
PyThread_free_lock (obj -> lock );
392
392
obj -> lock = NULL ;
393
393
}
394
- PyTypeObject * tp = Py_TYPE (self );
395
- Py_DECREF (tp );
396
394
397
395
PyObject_Del (self );
396
+
397
+ PyTypeObject * tp = Py_TYPE (self );
398
+ Py_DECREF (tp );
398
399
}
399
400
400
401
static PyType_Slot blake2b_type_slots [] = {
Original file line number Diff line number Diff line change @@ -37,9 +37,11 @@ static struct PyMethodDef blake2mod_functions[] = {
37
37
#define ADD_INT (d , name , value ) do { \
38
38
PyObject *x = PyLong_FromLong(value); \
39
39
if (!x) { \
40
+ Py_DECREF(x); \
40
41
return -1; \
41
42
} \
42
43
if (PyDict_SetItemString(d, name, x) < 0) { \
44
+ Py_DECREF(x); \
43
45
return -1; \
44
46
} \
45
47
Py_DECREF(x); \
@@ -53,6 +55,8 @@ static int blake2_exec(PyObject *m)
53
55
st -> blake2b_type = (PyTypeObject * )PyType_FromModuleAndSpec (
54
56
m , & blake2b_type_spec , NULL );
55
57
58
+ if (NULL == st -> blake2b_type )
59
+ return -1 ;
56
60
/* BLAKE2b */
57
61
if (PyModule_AddType (m , st -> blake2b_type ) < 0 ) {
58
62
return -1 ;
@@ -73,6 +77,9 @@ static int blake2_exec(PyObject *m)
73
77
st -> blake2s_type = (PyTypeObject * )PyType_FromModuleAndSpec (
74
78
m , & blake2s_type_spec , NULL );
75
79
80
+ if (NULL == st -> blake2s_type )
81
+ return -1 ;
82
+
76
83
if (PyModule_AddType (m , st -> blake2s_type ) < 0 ) {
77
84
return -1 ;
78
85
}
Original file line number Diff line number Diff line change @@ -391,10 +391,10 @@ py_blake2s_dealloc(PyObject *self)
391
391
obj -> lock = NULL ;
392
392
}
393
393
394
+ PyObject_Del (self );
395
+
394
396
PyTypeObject * tp = Py_TYPE (self );
395
397
Py_DECREF (tp );
396
-
397
- PyObject_Del (self );
398
398
}
399
399
400
400
static PyType_Slot blake2s_type_slots [] = {
You can’t perform that action at this time.
0 commit comments