Re: [PATCH] tpm: Create cleanup class for tpm_buf

From: Jarkko Sakkinen
Date: Wed Jun 25 2025 - 17:45:46 EST


On Thu, Jun 26, 2025 at 12:37:56AM +0300, Jarkko Sakkinen wrote:
> From: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxx>
>
> Define a cleanup for tpm_buf, which will caused tpm_buf_destroy()
> automatically called at the end of a function scope. This will
> significantly decrease the likelihood of memory leaks.

Oops, this did not go well.

Here's a corrected version.

"Define a cleanup class for struct tpm_buf, which will take
the responsibility of calling tpm_buf_destroy() automatically
when tpm_buf instance is going out of scope."

For the code change itself I noticed that I missed tpm-sysfs.c
i.e., v2 coming post the feedback for this.

BR, Jarkko