Skip to content

tools, test: Fix missing NULL checks after malloc#3564

Merged
JuergenReppSIT merged 2 commits into
tpm2-software:masterfrom
hyperfinitism:fix/malloc-null-check
Mar 4, 2026
Merged

tools, test: Fix missing NULL checks after malloc#3564
JuergenReppSIT merged 2 commits into
tpm2-software:masterfrom
hyperfinitism:fix/malloc-null-check

Conversation

@hyperfinitism
Copy link
Copy Markdown
Contributor

This PR fixes several places where malloc() return values were used without a NULL check. The changes are split into two commits to keep the review straightforward:

  1. tools/: production code fixes (add missing NULL checks and OOM handling)
    • tpm2_duplicate.c
    • tpm2_encryptdecrypt.c
    • tpm2_getekcertificate.c
    • tpm2_nvreadpublic.c
    • tpm2_verifysignature.c
  2. test/unit/: test fixes (add assert_non_null after malloc())
    • test_tpm2_auth_util.c
    • test_tpm2_session.c

Signed-off-by: Takuma IMAMURA <209989118+hyperfinitism@users.noreply.github.com>
Signed-off-by: Takuma IMAMURA <209989118+hyperfinitism@users.noreply.github.com>
@JuergenReppSIT JuergenReppSIT merged commit 8cc5d12 into tpm2-software:master Mar 4, 2026
23 checks passed
@hyperfinitism hyperfinitism deleted the fix/malloc-null-check branch March 4, 2026 10:51
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.

2 participants