Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWOUa-0001ux-Jj for pgsql-bugs@arkaria.postgresql.org; Fri, 01 Oct 2021 19:46:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mWOUZ-0003v1-7t for pgsql-bugs@arkaria.postgresql.org; Fri, 01 Oct 2021 19:46:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWOUZ-0003ut-1X for pgsql-bugs@lists.postgresql.org; Fri, 01 Oct 2021 19:46:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mWOUU-0002d0-Ll for pgsql-bugs@lists.postgresql.org; Fri, 01 Oct 2021 19:46:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 191Jkds93632213; Fri, 1 Oct 2021 15:46:39 -0400 From: Tom Lane To: Timo Sirainen cc: pgsql-bugs@lists.postgresql.org Subject: Re: libpq leaks memory for SSL connections In-reply-to: References: Comments: In-reply-to Timo Sirainen message dated "Fri, 01 Oct 2021 14:49:38 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3632211.1633117599.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 01 Oct 2021 15:46:39 -0400 Message-ID: <3632212.1633117599@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Timo Sirainen writes: > I noticed with valgrind how libpq is leaking memory: > at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_me= mcheck-amd64-linux.so) > by 0x5F645C8: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1= .1) > by 0x5E94EEF: BIO_meth_new (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.= 1) > by 0x65181EB: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.11) > by 0x651950C: ??? (in /usr/lib/x86_64-linux-gnu/libpq.so.5.11) > by 0x650140F: PQconnectPoll (in /usr/lib/x86_64-linux-gnu/libpq.so.5.11) I see no leak here. The struct is allocated once and kept for possible re-use by future connections. valgrind concurs, saying it's "still reachable". regards, tom lane