[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 5/8] tmp backend: Add new api to read backend
From: |
Amarnath Valluri |
Subject: |
Re: [Qemu-devel] [PATCH v6 5/8] tmp backend: Add new api to read backend TpmInfo |
Date: |
Sat, 22 Jul 2017 07:30:48 +0300 |
On Tue, 2017-07-18 at 09:28 -0500, Eric Blake wrote:
> On 07/18/2017 05:39 AM, Marc-André Lureau wrote:
> > Hi
> >
> > On Tue, Jul 18, 2017 at 1:49 AM, Amarnath Valluri
> > <address@hidden> wrote:
> >> TPM configuration options are backend implementation details and shall not
> >> be
> >> part of base TPMBackend object, and these shall not be accessed directly
> >> outside
> >> of the class, hence added a new interface method, get_tpm_options() to
> >> TPMDriverOps., which shall be implemented by the derived classes to return
> >> configured tpm options.
> >>
> > One usually prefer to have the true case first.
> >
> >> + } else {
> >> + tpm_pt->ops->has_path = true;
> >> }
> >>
> >> + tpm_pt->ops->path = g_strdup(value);
> >
> > Interestingly, ops->path will be set even if ops->has_path = false. I
> > am not sure the visitors will handle that case properly (for visit or
> > dealloc etc). Could you set ops->has_path = true uncondtionnally?
>
> tmp_pt->opt->path is ignored if has_path is false; if it is assigned to
> malloc'd memory, then you leak that memory when freeing tpm_pt.
Yes, i agree there is memory leak here, i will fix it.
- Amarnath
- [Qemu-devel] [PATCH v6 0/8] Provide support for the software TPM emulator, Amarnath Valluri, 2017/07/18
- [Qemu-devel] [PATCH v6 3/8] tpm-backend: Initialize and free data members in it's own methods, Amarnath Valluri, 2017/07/18
- [Qemu-devel] [PATCH v6 2/8] tpm-backend: Move thread handling inside TPMBackend, Amarnath Valluri, 2017/07/18
- [Qemu-devel] [PATCH v6 6/8] tpm-backend: Move realloc_buffer() implementation to tpm-tis model, Amarnath Valluri, 2017/07/18
- [Qemu-devel] [PATCH v6 7/8] tpm-passthrough: move reusable code to utils, Amarnath Valluri, 2017/07/18
- [Qemu-devel] [PATCH v6 8/8] tpm: Added support for TPM emulator, Amarnath Valluri, 2017/07/18