Skip to content

Forgot to add error check? #106916

Closed
Closed
@Eclips4

Description

@Eclips4

#106411 adds the _PyCompile_CleanDoc function.
there's a call to PyMem_Malloc, but we don't check if it returns NULL value:

cpython/Python/compile.c

Lines 8055 to 8063 in 009e8f0

char *buff = PyMem_Malloc(doc_size);
char *w = buff;
while (p < pend) {
int ch = *w++ = *p++;
if (ch == '\n') {
break;
}
}

Is there a need to check for a NULL value?
If so, I can send a PR.

Linked PRs

Metadata

Metadata

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions