File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -2093,20 +2093,25 @@ hashlib_init_constructors(PyObject *module)
20932093 }
20942094 func = PyObject_GetAttrString (module , fdef -> ml_name );
20952095 if (func == NULL ) {
2096+ Py_DECREF (name_obj );
20962097 return -1 ;
20972098 }
2098- if (PyDict_SetItem (state -> constructs , func , name_obj ) < 0 ) {
2099- return -1 ;
2100- }
2099+ int rc = PyDict_SetItem (state -> constructs , func , name_obj );
21012100 Py_DECREF (func );
21022101 Py_DECREF (name_obj );
2102+ if (rc < 0 ) {
2103+ return -1 ;
2104+ }
21032105 }
21042106
21052107 proxy = PyDictProxy_New (state -> constructs );
21062108 if (proxy == NULL ) {
21072109 return -1 ;
21082110 }
2109- if (PyModule_AddObjectRef (module , "_constructors" , proxy ) < 0 ) {
2111+
2112+ int rc = PyModule_AddObjectRef (module , "_constructors" , proxy );
2113+ Py_DECREF (proxy );
2114+ if (rc < 0 ) {
21102115 return -1 ;
21112116 }
21122117 return 0 ;
You can’t perform that action at this time.
0 commit comments