From: Steve Dickson <SteveD@RedHat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] gssd: Closed a memory leak in find_keytab_entry()
Date: Fri, 14 Feb 2020 16:41:16 -0500 [thread overview]
Message-ID: <a256db55-1d40-bf4a-a131-4bdac4bf37f7@RedHat.com> (raw)
In-Reply-To: <20200212190515.7443-1-steved@redhat.com>
On 2/12/20 2:05 PM, Steve Dickson wrote:
> When 'adhostoverride' is "not set", which
> is most of the time, adhostoverride is not freed.
>
> Signed-off-by: Steve Dickson <steved@redhat.com>
Committed...
stesved
> ---
> utils/gssd/krb5_util.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
> index a1c43d2..85f60ae 100644
> --- a/utils/gssd/krb5_util.c
> +++ b/utils/gssd/krb5_util.c
> @@ -799,7 +799,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
> int tried_all = 0, tried_default = 0, tried_upper = 0;
> krb5_principal princ;
> const char *notsetstr = "not set";
> - char *adhostoverride;
> + char *adhostoverride = NULL;
>
>
> /* Get full target hostname */
> @@ -827,7 +827,6 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
> adhostoverride);
> /* No overflow: Windows cannot handle strings longer than 19 chars */
> strcpy(myhostad, adhostoverride);
> - free(adhostoverride);
> } else {
> strcpy(myhostad, myhostname);
> for (i = 0; myhostad[i] != 0; ++i) {
> @@ -836,6 +835,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
> myhostad[i] = '$';
> myhostad[i+1] = 0;
> }
> + if (adhostoverride)
> + krb5_free_string(context, adhostoverride);
>
> if (!srchost) {
> retval = get_full_hostname(myhostname, myhostname, sizeof(myhostname));
>
prev parent reply other threads:[~2020-02-14 21:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 19:05 [PATCH] gssd: Closed a memory leak in find_keytab_entry() Steve Dickson
2020-02-14 21:41 ` Steve Dickson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a256db55-1d40-bf4a-a131-4bdac4bf37f7@RedHat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).