Skip to content

check malloc return value in allocator_init#210

Merged
hami-robot[bot] merged 1 commit into
Project-HAMi:mainfrom
mesutoezdil:fix/malloc-null-check-allocator
Jun 30, 2026
Merged

check malloc return value in allocator_init#210
hami-robot[bot] merged 1 commit into
Project-HAMi:mainfrom
mesutoezdil:fix/malloc-null-check-allocator

Conversation

@mesutoezdil

Copy link
Copy Markdown
Contributor

LIST_INIT dereferences the pointer immediately after malloc. If malloc returns NULL (e.g. under memory pressure), the process crashes with a segfault and no diagnostic output.

Add a NULL check after each malloc call and exit with an error log so the failure is visible.

LIST_INIT dereferences the pointer immediately after malloc.
A NULL return would crash silently; exit with an error instead.

Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
@mesutoezdil mesutoezdil force-pushed the fix/malloc-null-check-allocator branch from ff23e67 to 422b6f3 Compare June 16, 2026 18:57

@DSFans2014 DSFans2014 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@archlitchi archlitchi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@hami-robot

hami-robot Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: archlitchi, mesutoezdil

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hami-robot hami-robot Bot added the approved label Jun 30, 2026
@hami-robot hami-robot Bot merged commit c75f226 into Project-HAMi:main Jun 30, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants