C-Plus-Plus
C-Plus-Plus copied to clipboard
fix: memory issues in `counting_sort.cpp`
Description of Change
There are several problems with the current implementation of counting_sort.cpp:
- memory allocated by creating
*Countis uninitialized and not deleted, https://github.com/TheAlgorithms/C-Plus-Plus/blob/23b133ae1eac4ad7e94e74da140d462180738413/sorting/counting_sort.cpp#L29 - memory allocated by creating
*Sorted_Arris not deleted. https://github.com/TheAlgorithms/C-Plus-Plus/blob/23b133ae1eac4ad7e94e74da140d462180738413/sorting/counting_sort.cpp#L27
This PR fixes that.
Checklist
- [x] Added description of change
- [x] PR title follows semantic commit guidelines
- [x] Search previous suggestions before making a new one, as yours may be a duplicate.
- [x] I acknowledge that all my contributions will be made under the project's license.
Notes:
This PR fixes memory issues in counting_sort.cpp.
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@Panquesito7, @realstealthninja: please dont-close.