[PATCH v1 1/2] auth: fix mem leak & use appropriate free function
Jeremy Allison
jra at samba.org
Wed Feb 1 00:11:16 UTC 2017
On Wed, Feb 01, 2017 at 07:19:28AM +1300, Andrew Bartlett wrote:
> On Tue, 2017-01-17 at 14:39 +0100, Aurelien Aptel wrote:
> > coverity fix.
> >
> > cli_credentials_set_principal does a strdup, we want to free 'name'
> > regardless of the result in 'ok'.
> >
> > Signed-off-by: Aurelien Aptel <aaptel at suse.com>
> > ---
> > auth/credentials/credentials_krb5.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/auth/credentials/credentials_krb5.c
> > b/auth/credentials/credentials_krb5.c
> > index 3663e1d..d2a655e 100644
> > --- a/auth/credentials/credentials_krb5.c
> > +++ b/auth/credentials/credentials_krb5.c
> > @@ -260,11 +260,11 @@ static int
> > cli_credentials_set_from_ccache(struct cli_credentials *cred,
> > }
> >
> > ok = cli_credentials_set_principal(cred, name, obtained);
> > + krb5_free_unparsed_name(ccache->smb_krb5_context-
> > >krb5_context, name);
> > if (!ok) {
> > krb5_free_principal(ccache->smb_krb5_context-
> > >krb5_context, princ);
> > return ENOMEM;
> > }
> > - free(name);
> >
> > realm = smb_krb5_principal_get_realm(ccache-
> > >smb_krb5_context->krb5_context,
> > princ);
>
> Reviewed-by: Andrew Bartlett <abartlet at samba.org>
>
> Can I get a second team reviewer here please?
LGTM. Pushed.
More information about the samba-technical
mailing list