From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19887 invoked from network); 14 Nov 2022 22:18:04 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 14 Nov 2022 22:18:04 -0000 Received: from tilde.team ([198.50.210.248]) by 9front; Mon Nov 14 17:17:03 -0500 2022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.team; s=mail; t=1668464222; bh=LcwQWaNcDNC1W3C3hfJ9VQ19mRFrAikW5FsHU1U0dYQ=; h=Date:From:To:Subject:References:In-Reply-To:From; b=0EAXiu9PDJSnyNnzEOHnC2S/gBv8vsiET4qjO9CC88ES6cqQ8ANVqe8AX6qeXrrEG CQp3EkqhqHceW5rcykmCQH2UY8ZBI7YM9vRcdB+20/aavQk4SS0Jv4NM9G+cjXjSaT T98mlYxy3M9wlva0qTZ9nD8PPmb3gkUD6xW/Bw7U= Received: from quark.home.arpa (unknown [IPv6:2607:fb90:938e:9f99:584:2801:2add:926c]) by tilde.team (Postfix) with ESMTPSA id 1A2414C1A67 for <9front@9front.org>; Mon, 14 Nov 2022 22:17:02 +0000 (UTC) Received: from localhost (quark.home.arpa [local]) by quark.home.arpa (OpenSMTPD) with ESMTPA id c5668e81 for <9front@9front.org>; Mon, 14 Nov 2022 17:17:01 -0500 (EST) Date: Mon, 14 Nov 2022 17:17:01 -0500 From: Josiah Frentsos To: 9front@9front.org Message-ID: Mail-Followup-To: 9front@9front.org References: <120DA5D8-E60E-4E6B-8E14-AFAE1D219D4F@musolino.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <120DA5D8-E60E-4E6B-8E14-AFAE1D219D4F@musolino.id.au> List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: configuration hardware full-stack dependency-oriented DOM generator Subject: Re: [9front] auth_getkey: Fix a memory leak Reply-To: 9front@9front.org Precedence: bulk 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?