File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ getpath_hassuffix(PyObject *Py_UNUSED(self), PyObject *args)
153
153
r = Py_True ;
154
154
}
155
155
Py_INCREF (r );
156
+ PyMem_Free ((void * )suffix );
156
157
}
157
158
}
158
159
return r ;
@@ -297,11 +298,11 @@ getpath_joinpath(PyObject *Py_UNUSED(self), PyObject *args)
297
298
if (!parts [i ]) {
298
299
continue ;
299
300
}
300
- if (i >= first ) {
301
- if (final && !final [0 ]) {
301
+ if (i >= first && final ) {
302
+ if (!final [0 ]) {
302
303
/* final is definitely long enough to fit any individual part */
303
304
wcscpy (final , parts [i ]);
304
- } else if (final && _Py_add_relfile (final , parts [i ], cchFinal ) < 0 ) {
305
+ } else if (_Py_add_relfile (final , parts [i ], cchFinal ) < 0 ) {
305
306
/* if we fail, keep iterating to free memory, but stop adding parts */
306
307
PyMem_Free (final );
307
308
final = NULL ;
@@ -334,12 +335,11 @@ getpath_readlines(PyObject *Py_UNUSED(self), PyObject *args)
334
335
return NULL ;
335
336
}
336
337
FILE * fp = _Py_wfopen (path , L"rb" );
338
+ PyMem_Free ((void * )path );
337
339
if (!fp ) {
338
340
PyErr_SetFromErrno (PyExc_OSError );
339
- PyMem_Free ((void * )path );
340
341
return NULL ;
341
342
}
342
- PyMem_Free ((void * )path );
343
343
344
344
r = PyList_New (0 );
345
345
if (!r ) {
You can’t perform that action at this time.
0 commit comments