Skip to content

fix memory leaks#294

Open
TaeZStkyoht wants to merge 4 commits intotpm2-software:masterfrom
TaeZStkyoht:fix-memory-leak
Open

fix memory leaks#294
TaeZStkyoht wants to merge 4 commits intotpm2-software:masterfrom
TaeZStkyoht:fix-memory-leak

Conversation

@TaeZStkyoht
Copy link
Copy Markdown

@TaeZStkyoht TaeZStkyoht commented Apr 3, 2025

  • BIGNUM must be freed both on tpm2tss_tpm2data_write and tpm2tss_tpm2data_read:
    definitely lost: 24 bytes in 1 blocks
    indirectly lost: 8 bytes in 1 blocks
  • TSSPRIVKEY's parent, privkey and pubkey members don't need to be allocated explicitly, because TSSPRIVKEY_new already does:
    definitely lost: 72 bytes in 3 blocks
    indirectly lost: 0 bytes in 0 blocks
  • TPM2_DATA* returned from RSA_get_app_data can be returned directly genkey_rsa() because RSA_free() doesn't free this item:
    definitely lost: 2,248 bytes in 1 blocks
    indirectly lost: 0 bytes in 0 blocks
  • update .gitignore to cover more generated files

@TaeZStkyoht TaeZStkyoht force-pushed the fix-memory-leak branch 4 times, most recently from d8fa737 to 1f35b76 Compare April 4, 2025 16:22
@williamcroberts
Copy link
Copy Markdown
Member

You have four different tasks that were mentioned in the commit message, one for each of the list items. I think this should be broken up into four commits instead of one, so please break this up into four commits.

- BIGNUM must be freed both on tpm2tss_tpm2data_write and tpm2tss_tpm2data_read:
definitely lost: 24 bytes in 1 blocks
indirectly lost: 8 bytes in 1 blocks

Signed-off-by: Oguzhan Turk <stkyoht@hotmail.com>
- TSSPRIVKEY's parent, privkey and pubkey members don't need to be allocated explicitly, because TSSPRIVKEY_new already does:
definitely lost: 72 bytes in 3 blocks
indirectly lost: 0 bytes in 0 blocks

Signed-off-by: Oguzhan Turk <stkyoht@hotmail.com>
- TPM2_DATA* returned from RSA_get_app_data can be returned directly genkey_rsa() because RSA_free() doesn't free this item:
definitely lost: 2,248 bytes in 1 blocks
indirectly lost: 0 bytes in 0 blocks

Signed-off-by: Oguzhan Turk <stkyoht@hotmail.com>
Signed-off-by: Oguzhan Turk <stkyoht@hotmail.com>
@TaeZStkyoht
Copy link
Copy Markdown
Author

You have four different tasks that were mentioned in the commit message, one for each of the list items. I think this should be broken up into four commits instead of one, so please break this up into four commits.

done

@TaeZStkyoht
Copy link
Copy Markdown
Author

I don't know about those errors on pipelines.

@williamcroberts
Copy link
Copy Markdown
Member

I don't know about those errors on pipelines.

I don't think it's you, I need to fix this

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.

3 participants