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: remove memory leak in reverse_a_linked_list.cpp #2439

Merged

Conversation

vil02
Copy link
Member

@vil02 vil02 commented Mar 2, 2023

Description of Change

In order to remove a memory leak in reverse_a_linked_list.cpp I have added a destructor to the class list. Furthermore I made some minor modifications, namely:

  • removed unused header,
  • added copy constructor and assignment operator,
  • made some member functions const,
  • suppressed some warnings related to lack of move copy constructor and move assignment operator and using the new operator.

Checklist

  • Added description of change
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:
Removes a memory leak in reverse_a_linked_list.cpp.

@Panquesito7 Panquesito7 added the Improvement improvement in previously written codes label Mar 6, 2023
@vil02 vil02 requested a review from Panquesito7 March 9, 2023 22:00
Panquesito7
Panquesito7 previously approved these changes Mar 10, 2023
Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

Great work. Thanks! 🚀

@Panquesito7 Panquesito7 requested a review from tjgurwara99 March 10, 2023 03:30
Copy link
Member

@tjgurwara99 tjgurwara99 left a comment

Choose a reason for hiding this comment

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

Other than that one comment, I defer my review to @Panquesito7 - I haven't run this algorithm locally but seems alright.

data_structures/reverse_a_linked_list.cpp Outdated Show resolved Hide resolved
@vil02 vil02 requested review from tjgurwara99 and Panquesito7 and removed request for tjgurwara99 March 18, 2023 23:20
Copy link
Member

@Panquesito7 Panquesito7 left a comment

Choose a reason for hiding this comment

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

Thanks! 🚀

@vil02
Copy link
Member Author

vil02 commented Mar 30, 2023

@Panquesito7 does this mean that this PR will be merged?

@Panquesito7 Panquesito7 merged commit 65efd47 into TheAlgorithms:master Mar 30, 2023
@vil02 vil02 deleted the memory_leak_in_reverse_a_linked_list_path branch March 30, 2023 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement improvement in previously written codes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants