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

add check for capacity size before allocating memory #704

Closed
wants to merge 1 commit into from

Conversation

alexanderMathew
Copy link

#693 (comment)

Added a check in [/native/src/seal/dynarray.h] to see if capacity > capacity_ before memory allocation

@kimlaine
Copy link
Contributor

kimlaine commented Oct 5, 2024

This doesn't implement the correct/expected functionality. While it might work in most cases, it doesn't correspond to the description of the function in the comments. In particular, if the given capacity is smaller than the current size, the function should automatically resize the DynArray to have size corresponding to the new given capacity. With your edit, the function can no longer be used to reduce the size of the DynArray container at all, which is not right either.

@kimlaine kimlaine closed this Oct 5, 2024
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