-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
[2.7] bpo-34395: Fix memory leaks caused by incautious usage of PyMem_Resize(). (GH-8756) #8785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Modules/_csv.c
Outdated
if (self->field == NULL) { | ||
char *field_new = self->field; | ||
PyMem_Resize(field_new, char, field_size_new); | ||
if (field == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be field_new
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks.
Also, variables need to be declared at the top of blocks (for C89 compliance). |
It is possible to make the code in 2.7 simpler, but I prefer the similarity with 3.x. |
On other side, the 2.7 code already is too different from the 3.x code. So I have simplified it a bit. |
https://bugs.python.org/issue34395