Skip to content
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

Minor memory fix #550

Merged
merged 4 commits into from
Jul 28, 2019
Merged

Minor memory fix #550

merged 4 commits into from
Jul 28, 2019

Conversation

a-bezrukov
Copy link
Contributor

PR intention

Fixes a minor memory leak.

Copy link
Contributor

@levonpetrosyan93 levonpetrosyan93 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@psolstice psolstice left a comment

Choose a reason for hiding this comment

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

@reubenyap reubenyap added this to the v0.13.8.3 milestone Jul 26, 2019
@a-bezrukov
Copy link
Contributor Author

a-bezrukov commented Jul 26, 2019

Take a fix from the bitcoin code instead
https://github.com/bitcoin/bitcoin/blob/master/src/httprpc.cpp#L114

They have a static keyword for the char buffer. Our code does not have anything to prevent the race condition on the array. I understand why you requested this change but I don't know what is better for you in this situation - leave it as implemented (without unnecessary copying from char array to vector), or apply their code without the static keyword. Please let me know.

@psolstice
Copy link
Contributor

Look carefully at their code

        static const unsigned int KEY_SIZE = 32;
        unsigned char out[KEY_SIZE];

static is only for size (rightfully so though I'd prefer constexpr). Buffer is not static

@reubenyap reubenyap requested a review from psolstice July 27, 2019 19:51
@reubenyap reubenyap merged commit 86d63df into master Jul 28, 2019
@a-bezrukov a-bezrukov deleted the leak_fix branch August 19, 2019 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants