[PR #1463] [CLOSED] fix: Prevent segmentation fault at Simple generic Stack #2063

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

📋 Pull Request Information

Original PR: https://github.com/TheAlgorithms/C/pull/1463
Author: @Artursrossi
Created: 3/19/2025
Status: Closed

Base: masterHead: master


📝 Commits (1)

  • fc37289 fix: Prevent segmentation fault at Simple generic Stack

📊 Changes

1 file changed (+2 additions, -11 deletions)

View changed files

📝 data_structures/stack/stack.c (+2 -11)

📄 Description

Description of Change

  • Prevent segmentation fault error at stack.c grow function
    • After malloc, there is an iteration without any check if malloc returned null

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: Used realloc instead of malloc


🔄 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/1463 **Author:** [@Artursrossi](https://github.com/Artursrossi) **Created:** 3/19/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`fc37289`](https://github.com/TheAlgorithms/C/commit/fc372890ee5881b36943feebc7c55924a6380377) fix: Prevent segmentation fault at Simple generic Stack ### 📊 Changes **1 file changed** (+2 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `data_structures/stack/stack.c` (+2 -11) </details> ### 📄 Description #### Description of Change - Prevent segmentation fault error at stack.c grow function - After malloc, there is an iteration without any check if malloc returned null #### References #### Checklist - [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: Used realloc instead of malloc --- <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:28:16 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/C#2063