Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ruclA-006Ytn-PA for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Apr 2024 18:33:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rucl7-006dfw-VZ for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Apr 2024 18:33:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rucl7-006dfo-KC for pgsql-hackers@lists.postgresql.org; Wed, 10 Apr 2024 18:33:21 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rucl4-002DqQ-3H for pgsql-hackers@postgresql.org; Wed, 10 Apr 2024 18:33:20 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 9A9BC3006C17 for ; Wed, 10 Apr 2024 20:33:14 +0200 (CEST) Received: from s899.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id 89FA82E29EDA; Wed, 10 Apr 2024 20:33:14 +0200 (CEST) Received: from s473.loopia.se (unknown [172.22.191.6]) by s899.loopia.se (Postfix) with ESMTP id 884232C8BAA2; Wed, 10 Apr 2024 20:33:14 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1.209 X-Spam-Level: X-Spam-Status: No, score=-1.209 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=disabled Authentication-Results: s473.loopia.se (amavisd-new); dkim=pass (2048-bit key) header.d=yesql.se Received: from s979.loopia.se ([172.22.191.6]) by s473.loopia.se (s473.loopia.se [172.22.190.13]) (amavisd-new, port 10024) with LMTP id X7eVCT5ajlee; Wed, 10 Apr 2024 20:33:14 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s979.loopia.se (Postfix) with ESMTPSA id E56EE10BC455; Wed, 10 Apr 2024 20:33:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yesql.se; s=loopiadkim1707475645; t=1712773994; bh=CGJG53p5w+FEBCFWCaWGJq67mZgXem9mDJKH7AT+K5I=; h=From:Subject:Date:In-Reply-To:Cc:To:References; b=uB3UcQePf9Yh2vnoQPSsd7IrqbS4NmrLH9MYdk1hqmjeR4FPYPhgIGUPHb+rwjsVa R3OGiOF2fwfV0Cq1+vAP7ObeKQL4hXfZpKP2UStvRhEohiXSS3aqtvHxDpiR7k2C2C 7SzBdzKf53ROdgJWe2hMt3W2ktYXSrJwb+YpzFsd+XKXUwhtGNN6hRamkUs6SPYhGG RVAJvbh+w1gkROhpbSmTQFWCl8FF/u4Oe9vojaOPFVDB0DUGKaLZtJ1rKw1FsXHrkQ wCujuHnxk/vyz9ML5x5zF2DRZ7qrj5NtL8rLODAhcm+q2+Wv2wvYm1AXz+eB4FHlOt kS/p/Te5o8Ssw== From: Daniel Gustafsson Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_852F46FF-7863-45A1-BE29-8CD869558E4E" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\)) Subject: Re: Fix resource leak (src/backend/libpq/be-secure-common.c) Date: Wed, 10 Apr 2024 20:33:03 +0200 In-Reply-To: Cc: PostgreSQL Hackers To: Ranier Vilela References: X-Mailer: Apple Mail (2.3774.500.171.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_852F46FF-7863-45A1-BE29-8CD869558E4E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 10 Apr 2024, at 20:31, Ranier Vilela wrote: >=20 > Em ter., 2 de abr. de 2024 =C3=A0s 15:31, Daniel Gustafsson = > escreveu: >> > On 2 Apr 2024, at 20:13, Ranier Vilela > wrote: >>=20 >> > Fix by freeing the pointer, like pclose_check (src/common/exec.c) = similar case. >>=20 >> Off the cuff, seems reasonable when loglevel is LOG. >=20 > Per Coverity. >=20 > Another case of resource leak, when loglevel is LOG. > In the function shell_archive_file = (src/backend/archive/shell_archive.c) > The pointer *xlogarchcmd* is not freed. Thanks, I'll have a look. I've left this for post-freeze on purpose to = not cause unnecessary rebasing. Will take a look over the next few days = unless beaten to it. -- Daniel Gustafsson --Apple-Mail=_852F46FF-7863-45A1-BE29-8CD869558E4E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On 10 Apr 2024, = at 20:31, Ranier Vilela <ranier.vf@gmail.com> wrote:

Em ter., 2 = de abr. de 2024 =C3=A0s 15:31, Daniel Gustafsson <daniel@yesql.se> = escreveu:
> On 2 Apr 2024, at 20:13, Ranier = Vilela <ranier.vf@gmail.com> wrote:

> Fix by freeing the pointer, like pclose_check (src/common/exec.c) = similar case.

Off the cuff, seems reasonable when loglevel is = LOG.

Per Coverity.

Another case of resource leak, when loglevel is = LOG.
In the function shell_archive_file = (src/backend/archive/shell_archive.c)
The pointer = *xlogarchcmd*  is not = freed.

Th= anks, I'll have a look.  I've left this for post-freeze on purpose = to not
cause unnecessary rebasing.  Will take a look over = the next few days unless
beaten to = it.

--
Daniel Gustafsson

= --Apple-Mail=_852F46FF-7863-45A1-BE29-8CD869558E4E--