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
> > <amarnath.vall...@intel.com> 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


Reply via email to