[PR #1211] fix: addition of two polynomials memory leak and linked list crash #1809

Closed
opened 2026-01-29 15:24:50 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/TheAlgorithms/C/pull/1211

State: closed
Merged: Yes


Description of Change

misc/poly_add.c two issues fixed:

  1. free_poly() doesn't free linked list correctly and memory leaked
  2. create_polynomial() inserts new term into linked list without a valid variable initialization(it don't show because stack frame is reused, pointer temp2 hold data that generated in previous call of create_polynomial(). that's insane.)

References

Checklist

  • Added description of change
  • 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:

**Original Pull Request:** https://github.com/TheAlgorithms/C/pull/1211 **State:** closed **Merged:** Yes --- #### Description of Change misc/poly_add.c two issues fixed: 1. free_poly() doesn't free linked list correctly and memory leaked 2. create_polynomial() inserts new term into linked list without a valid variable initialization(it don't show because stack frame is reused, pointer temp2 hold data that generated in previous call of create_polynomial(). that's insane.) <!-- Thank you for your Pull Request. Please provide a description above and review the requirements below. Contributors guide: https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md --> #### References <!-- Add any reference to previous pull-request or issue --> #### Checklist <!-- Remove items that do not apply. For completed items, change [ ] to [x]. --> - [x] Added description of change - [x] PR title follows semantic [commit guidelines](https://github.com/TheAlgorithms/C/blob/master/CONTRIBUTING.md#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: <!-- Please add a one-line description for developers or pull request viewers -->
claunia added the pull-request label 2026-01-29 15:24:50 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#1809