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

Fix memory leak of scrypt() #68

Merged
merged 1 commit into from
Aug 18, 2022

Conversation

kocsismate
Copy link
Collaborator

No description provided.

@kocsismate kocsismate requested a review from DomBlack August 18, 2022 08:33
@@ -199,11 +199,11 @@ PHP_FUNCTION(scrypt)
php_hash_bin2hex(hex, buf, keyLength);
efree(buf);
hex[keyLength*2] = '\0';
RETURN_STRINGL(hex, keyLength * 2);
RETVAL_STRINGL(hex, keyLength * 2);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@remicollet I'd appreciate your review as well :)

Copy link
Contributor

@remicollet remicollet Aug 18, 2022

Choose a reason for hiding this comment

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

LGTM

BTW, double allocation could be avoid, using something like https://github.com/php/php-src/blob/master/ext/hash/hash.c#L411 (PHP 7+ only)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the suggestion! BTW: I've already increased the minimum version requirement to PHP 7.0 yesterday :)

@kocsismate kocsismate merged commit fe6c4d8 into DomBlack:master Aug 18, 2022
@kocsismate kocsismate deleted the fix-memory-leak branch August 18, 2022 08:56
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.

2 participants