mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
#3773: Check for errors around the use of PyTokenizer_FindEncoding().
reviewed by Brett Cannon.
This commit is contained in:
parent
1d6a16bf38
commit
1b933ed50a
3 changed files with 9 additions and 1 deletions
|
|
@ -1610,7 +1610,10 @@ PyTokenizer_FindEncoding(int fd)
|
|||
fclose(fp);
|
||||
if (tok->encoding) {
|
||||
encoding = (char *)PyMem_MALLOC(strlen(tok->encoding) + 1);
|
||||
strcpy(encoding, tok->encoding);
|
||||
if (encoding)
|
||||
strcpy(encoding, tok->encoding);
|
||||
else
|
||||
PyErr_NoMemory();
|
||||
}
|
||||
PyTokenizer_Free(tok);
|
||||
return encoding;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue