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

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

📋 Pull Request Information

Original PR: https://github.com/TheAlgorithms/C/pull/1211
Author: @hexingb
Created: 2/6/2023
Status: Merged
Merged: 3/13/2023
Merged by: @Panquesito7

Base: masterHead: master


📝 Commits (2)

  • 7c667df fix: addition of two polynomials memory leak and linked list crash
  • c0908b6 Merge branch 'master' into master

📊 Changes

1 file changed (+14 additions, -32 deletions)

View changed files

📝 misc/poly_add.c (+14 -32)

📄 Description

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:


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/TheAlgorithms/C/pull/1211 **Author:** [@hexingb](https://github.com/hexingb) **Created:** 2/6/2023 **Status:** ✅ Merged **Merged:** 3/13/2023 **Merged by:** [@Panquesito7](https://github.com/Panquesito7) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (2) - [`7c667df`](https://github.com/TheAlgorithms/C/commit/7c667dfd12e9c419d2566ccf9ecda85b656053f3) fix: addition of two polynomials memory leak and linked list crash - [`c0908b6`](https://github.com/TheAlgorithms/C/commit/c0908b6d67de11cc2b6aebbdd667b9431156cd4d) Merge branch 'master' into master ### 📊 Changes **1 file changed** (+14 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `misc/poly_add.c` (+14 -32) </details> ### 📄 Description #### 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 --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 15:24:49 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#1805