Skip to content

Fix null pointer dereference in nvMemoryPool_free#6

Open
prjanitor wants to merge 1 commit into
kadir014:mainfrom
prjanitor:prjanitor/c152499fcee061c8640e8763666cc0e6f9e86c50
Open

Fix null pointer dereference in nvMemoryPool_free#6
prjanitor wants to merge 1 commit into
kadir014:mainfrom
prjanitor:prjanitor/c152499fcee061c8640e8763666cc0e6f9e86c50

Conversation

@prjanitor

Copy link
Copy Markdown

Summary

The nvMemoryPool_free function did not check if the pool pointer was null before accessing pool->pool and freeing the pool structure. This could cause a null pointer dereference crash when the function is called with a null pointer.

Changes

  • Added null check at the beginning of nvMemoryPool_free function
  • Returns early if pool is null, preventing null pointer dereference

Testing

The fix follows the same pattern used in other similar functions in the codebase (e.g., nvArray_free in src/core/array.c).

Related

Fixes bug #639: Missing null check in nvMemoryPool_free before accessing pool members


This PR was generated by PRJanitor — an automated tool that finds and fixes small bugs in open-source projects.

We respect your contribution guidelines — if your project doesn't accept bot PRs, we won't send more. You can also add a .github/prjanitor.yml file with enabled: false to opt out explicitly.

Add null check for pool pointer before accessing pool members to prevent crash when freeing a null pointer.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant