File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,19 +129,30 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
129129 handle = dlopen (pathname , dlopenflags );
130130
131131 if (handle == NULL ) {
132- PyObject * mod_name = NULL ;
133- PyObject * path = NULL ;
134- PyObject * error_ob = NULL ;
132+ PyObject * mod_name ;
133+ PyObject * path ;
134+ PyObject * error_ob ;
135135 const char * error = dlerror ();
136136 if (error == NULL )
137137 error = "unknown dlopen() error" ;
138138 error_ob = PyUnicode_FromString (error );
139- path = PyUnicode_FromString (pathname );
139+ if (error_ob == NULL )
140+ return NULL ;
140141 mod_name = PyUnicode_FromString (shortname );
142+ if (mod_name == NULL ) {
143+ Py_DECREF (error_ob );
144+ return NULL ;
145+ }
146+ path = PyUnicode_FromString (pathname );
147+ if (path == NULL ) {
148+ Py_DECREF (error_ob );
149+ Py_DECREF (mod_name );
150+ return NULL ;
151+ }
141152 PyErr_SetImportError (error_ob , mod_name , path );
142- Py_XDECREF (error_ob );
143- Py_XDECREF ( path );
144- Py_XDECREF ( mod_name );
153+ Py_DECREF (error_ob );
154+ Py_DECREF ( mod_name );
155+ Py_DECREF ( path );
145156 return NULL ;
146157 }
147158 if (fp != NULL && nhandles < 128 )
You can’t perform that action at this time.
0 commit comments