Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
469b0a50
Commit
469b0a50
authored
Mar 20, 2019
by
Victor Stinner
Committed by
GitHub
Mar 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442) (GH-12470)
(cherry picked from commit
cb90c89d
)
parent
07b8018d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
Parser/tokenizer.c
Parser/tokenizer.c
+8
-2
No files found.
Parser/tokenizer.c
View file @
469b0a50
...
...
@@ -656,9 +656,14 @@ translate_newlines(const char *s, int exec_input, struct tok_state *tok) {
}
*
current
=
'\0'
;
final_length
=
current
-
buf
+
1
;
if
(
final_length
<
needed_length
&&
final_length
)
if
(
final_length
<
needed_length
&&
final_length
)
{
/* should never fail */
buf
=
PyMem_REALLOC
(
buf
,
final_length
);
char
*
result
=
PyMem_REALLOC
(
buf
,
final_length
);
if
(
result
==
NULL
)
{
PyMem_FREE
(
buf
);
}
buf
=
result
;
}
return
buf
;
}
...
...
@@ -974,6 +979,7 @@ tok_nextc(register struct tok_state *tok)
newbuf
=
(
char
*
)
PyMem_REALLOC
(
newbuf
,
newsize
);
if
(
newbuf
==
NULL
)
{
PyMem_FREE
(
tok
->
buf
);
tok
->
done
=
E_NOMEM
;
tok
->
cur
=
tok
->
inp
;
return
EOF
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment