9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Alex Musolino <alex@musolino.id.au>
To: 9front@9front.org
Subject: Re: [9front] auth_getkey: Fix a memory leak
Date: Mon, 14 Nov 2022 22:45:48 +0100	[thread overview]
Message-ID: <120DA5D8-E60E-4E6B-8E14-AFAE1D219D4F@musolino.id.au> (raw)
In-Reply-To: <Y3KEWS1Z198BLZbo@quark.home.arpa>


> 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.

  reply	other threads:[~2022-11-14 21:47 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 [this message]
2022-11-14 22:17   ` Josiah Frentsos
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=120DA5D8-E60E-4E6B-8E14-AFAE1D219D4F@musolino.id.au \
    --to=alex@musolino.id.au \
    --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).