Skip to content

Commit 8ed8cfc

Browse files
committed
gh-151126: Fix missing memory error in os._path_splitroot
1 parent 0066fd7 commit 8ed8cfc

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix :exc:`MemoryError` in :func:`!os._path_splitroot`.

Modules/posixmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5699,7 +5699,7 @@ os__path_splitroot_impl(PyObject *module, path_t *path)
56995699

57005700
buffer = (wchar_t*)PyMem_Malloc(sizeof(wchar_t) * (wcslen(path->wide) + 1));
57015701
if (!buffer) {
5702-
return NULL;
5702+
return PyErr_NoMemory();
57035703
}
57045704
wcscpy(buffer, path->wide);
57055705
for (wchar_t *p = wcschr(buffer, L'/'); p; p = wcschr(p, L'/')) {

0 commit comments

Comments
 (0)