Skip to content

Conversation

@joerowell
Copy link

@joerowell joerowell commented Nov 15, 2022

At the moment hkdf_expand allocates memory on each iteration of the loop but never frees it:

for(int i = 1; i <= N; i++) {
    auto input = new block[8 + info_len + cur_T_len];
    ...
}

This means that the program leaks memory each time hkdf_expand is called.

This PR fixes this by:

  1. Moving the allocation outside of the loop. This should also make the code run faster.
  2. Freeing the memory after the loop terminates.

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.

1 participant