Skip to content

Commit ce8b81f

Browse files
gh-151763: Fix NULL dereference in os._path_normpath() under OOM (#151779)
1 parent b35c379 commit ce8b81f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Modules/posixmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6145,6 +6145,9 @@ os__path_normpath_impl(PyObject *module, path_t *path)
61456145
else {
61466146
result = PyUnicode_FromWideChar(norm_path, norm_len);
61476147
}
6148+
if (result == NULL) {
6149+
return NULL;
6150+
}
61486151
if (PyBytes_Check(path->object)) {
61496152
Py_SETREF(result, PyUnicode_EncodeFSDefault(result));
61506153
}

0 commit comments

Comments
 (0)