[PATCH v1 1/2] auth: fix mem leak & use appropriate free function
Andrew Bartlett
abartlet at samba.org
Tue Jan 31 18:19:28 UTC 2017
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?
Thanks,
Andrew Bartlett
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Catalyst IT http://catalyst.net.nz/services/samba
More information about the samba-technical
mailing list