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
cb90c89d
Commit
cb90c89d
authored
Mar 19, 2019
by
Pablo Galindo
Committed by
GitHub
Mar 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442)
parent
dcf61715
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 @
cb90c89d
...
...
@@ -649,9 +649,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
;
}
...
...
@@ -958,6 +963,7 @@ tok_nextc(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