Skip to content

[#1722] Check allocation in pgmoneta_art_iterator_create - #1723

Closed
manishpatel00 wants to merge 1 commit into
pgmoneta:mainfrom
manishpatel00:issue1722_art_null_check
Closed

manishpatel00 wants to merge 1 commit into
pgmoneta:mainfrom
manishpatel00:issue1722_art_null_check

Conversation

@manishpatel00

Copy link
Copy Markdown
Contributor

Fixes #1722

Description

In commit 3e71975 ("Fix ART iterator re-seeding root after remove"), i->started = false; was added to pgmoneta_art_iterator_create() in src/libpgmoneta/art.c. Because malloc(sizeof(struct art_iterator)) was not checked for NULL, this triggered an additional nullPointerOutOfMemory warning under cppcheck (18 findings vs 17 in the baseline), causing CI static-analysis to fail on main and all dependent PRs.

Changes

  1. Added a NULL check after malloc in pgmoneta_art_iterator_create(), returning 1 on allocation failure.
  2. Updated .github/cppcheck-baseline.txt for nullPointerOutOfMemory:src/libpgmoneta/art.c from 17 to 13 to reflect the resolved dereferences.

Check if malloc succeeds in pgmoneta_art_iterator_create to prevent
potential null pointer dereference and satisfy cppcheck static analysis.
Update .github/cppcheck-baseline.txt accordingly.

Signed-off-by: Manish Kumar <[email protected]>
@manishpatel00

Copy link
Copy Markdown
Contributor Author

Hi @jesperpedersen,

For convenience, this allocation check for #1722 has also been included in PR #1725 along with the #1724 AddressSanitizer/tablespace fix to unblock the entire CI test suite and achieve a completely green 13/13 test run. Thank you!

@Pranav-error

Copy link
Copy Markdown
Collaborator

This is in main now via #1725 (same art.c check, baseline 13), so this can be closed.

@ecleon26

Copy link
Copy Markdown
Collaborator

This is in main via #1725, so closing.

@ecleon26 ecleon26 closed this Nov 29, 2026
@manishpatel00
manishpatel00 deleted the issue1722_art_null_check branch November 29, 2026 19:03
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.

Static analysis failure: unchecked allocation in art.c

3 participants