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 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26756 invoked from network); 21 Jan 2023 07:58:28 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 21 Jan 2023 07:58:28 -0000 Received: from mx2.mythic-beasts.com ([46.235.227.24]) by 9front; Sat Jan 21 02:55:16 -0500 2023 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=quintile.net; s=mythic-beasts-k1; h=To:Date:Subject:From; bh=Z4IYytVb1jNuzlkap4hnIO6ENIwrdTZPd7CpjP/iSwc=; b=RP/7GwlAQNT+JfbTajh7JVM0Xe rrQYQls/Kswo1oxTKm+6SgOhA9U2dezBye2zq9lU3dLiPyO+crSwS1vSEdYBoAe2WpmA+OWTO0y2K xc/ggHnkaxmD5P20KTSqu7vPSXm3nhb3aFNP/c+twnW7k3RXyuPPGce7VYeBjhb/1qJMHTgMrYF/3 LXsOJ5tV9Ry9E/Ff0HvXvnsX4RSHT+r9ovwo48xFeSuIAa80Xzf0Q6YSdoPZJlA+ke4L+Or9R3Vbb vqTjl98MGTTQH0ly1ayTTeGcB32KfV0PStM1UTGwAK4urroDvofEQ/mDy5ES/a3u3P8AnSbYnsw9Q TdnBoisQ==; Received: from [81.187.198.132] (port=65010 helo=smtpclient.apple) by mailhub-hex-d.mythic-beasts.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pJ8iZ-00DOcu-7B for 9front@9front.org; Sat, 21 Jan 2023 07:55:15 +0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Steve Simon Mime-Version: 1.0 (1.0) Date: Sat, 21 Jan 2023 07:55:02 +0000 Message-Id: References: In-Reply-To: To: 9front@9front.org X-Mailer: iPhone Mail (20C65) X-BlackCat-Spam-Score: 4 List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: social asynchronous persistence markup Subject: Re: [9front] lock: Fix some memory leaks Reply-To: 9front@9front.org Precedence: bulk sorry, but this patch looks very wrong. free after return does nothing. calling waitfor twice allocates data twice. i would also consider what happens after the waitfor() call - i have not loo= ked at the source but i have a suspicion that lock exits, so there is no poi= nt in freeing memory anyway. -Steve > On 21 Jan 2023, at 12:18 am, Josiah Frentsos wrote: >=20 > =EF=BB=BFdiff bb36ba0617b5aa8263ea9b5ece8c1a5249fedc86 uncommitted > --- a/sys/src/cmd/lock.c > +++ b/sys/src/cmd/lock.c > @@ -35,6 +35,7 @@ > } > if (w->pid =3D=3D pid) > return w; > + free(w); > } > } >=20 > @@ -141,7 +142,8 @@ > error("wait"); >=20 > postnote(PNPROC, lckpid, "die"); > - waitfor(lckpid); > + free(waitfor(lckpid)); > + > if(w->msg[0]){ > p =3D utfrune(w->msg, ':'); > if(p && p[1])