File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -129,19 +129,30 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
129
129
handle = dlopen (pathname , dlopenflags );
130
130
131
131
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 ;
135
135
const char * error = dlerror ();
136
136
if (error == NULL )
137
137
error = "unknown dlopen() error" ;
138
138
error_ob = PyUnicode_FromString (error );
139
- path = PyUnicode_FromString (pathname );
139
+ if (error_ob == NULL )
140
+ return NULL ;
140
141
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
+ }
141
152
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 );
145
156
return NULL ;
146
157
}
147
158
if (fp != NULL && nhandles < 128 )
You can’t perform that action at this time.
0 commit comments