9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Josiah Frentsos <jfrent@tilde.team>
To: 9front@9front.org
Subject: Re: [9front] auth_getkey: Fix a memory leak
Date: Mon, 14 Nov 2022 17:17:01 -0500	[thread overview]
Message-ID: <Y3K+XZezFFzSTxX+@quark.home.arpa> (raw)
In-Reply-To: <120DA5D8-E60E-4E6B-8E14-AFAE1D219D4F@musolino.id.au>

On Mon, Nov 14, 2022 at 10:45:48PM +0100, Alex Musolino wrote:
> > diff 0e9c5f30eabbf213023658efb863dbaf6a608a51 uncommitted
> > --- a/sys/src/libauth/auth_getkey.c
> > +++ b/sys/src/libauth/auth_getkey.c
> > @@ -25,6 +25,7 @@
> >        werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params);
> >        return -1;
> >    }
> > +    free(d);
> >    switch(pid = fork()){
> >    case -1:
> >        werrstr("can't fork for %s: %r", name);
> 
> Good find, but we need to free the Dir in the ???/factotum may be bad??? case too. Just latch the type and free the Dir unconditionally before checking the type.

if(0)	if(d->type != '/'){
^^^^^
		werrstr("auth_getkey: /factotum may be bad: didn't get key %s", params);
		return -1;
	}

Should that part be removed?

  reply	other threads:[~2022-11-14 22:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 18:09 Josiah Frentsos
2022-11-14 21:45 ` Alex Musolino
2022-11-14 22:17   ` Josiah Frentsos [this message]
2022-11-15  9:44     ` Alex Musolino
2022-11-15 22:33       ` Josiah Frentsos
2022-11-19 14:06       ` Josiah Frentsos
2022-11-19 14:10         ` Josiah Frentsos
2022-11-30 15:01           ` Josiah Frentsos
2022-12-12  0:33             ` Josiah Frentsos
2022-12-12  1:14               ` cinap_lenrek
2022-11-30 15:01         ` Josiah Frentsos
2022-12-12  0:32           ` Josiah Frentsos

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=Y3K+XZezFFzSTxX+@quark.home.arpa \
    --to=jfrent@tilde.team \
    --cc=9front@9front.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).