Skip to content

[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

Merged
merged 5 commits into from
Aug 17, 2018

Conversation

sir-sigurd
Copy link
Contributor

@sir-sigurd sir-sigurd commented Aug 16, 2018

Modules/_csv.c Outdated
if (self->field == NULL) {
char *field_new = self->field;
PyMem_Resize(field_new, char, field_size_new);
if (field == NULL) {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks.

@ZackerySpytz
Copy link
Contributor

Also, variables need to be declared at the top of blocks (for C89 compliance).

@serhiy-storchaka
Copy link
Member

It is possible to make the code in 2.7 simpler, but I prefer the similarity with 3.x.

@serhiy-storchaka
Copy link
Member

On other side, the 2.7 code already is too different from the 3.x code. So I have simplified it a bit.

@serhiy-storchaka serhiy-storchaka merged commit ae1f012 into python:2.7 Aug 17, 2018
@sir-sigurd sir-sigurd deleted the bpo-34395-2.7 branch August 17, 2018 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants