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 1oTktW-0003oC-V5 for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 14:10:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oTktV-00019g-GQ for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2022 14:10:09 +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 1oTktV-00019X-6q for pgsql-hackers@lists.postgresql.org; Thu, 01 Sep 2022 14:10:09 +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 1oTktS-0008Vi-TA for pgsql-hackers@lists.postgresql.org; Thu, 01 Sep 2022 14:10:08 +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 281EA4SZ403276; Thu, 1 Sep 2022 10:10:04 -0400 From: Tom Lane To: Junwang Zhao cc: PostgreSQL Hackers Subject: Re: [PATCH v1] fix potential memory leak in untransformRelOptions In-reply-to: References: Comments: In-reply-to Junwang Zhao message dated "Thu, 01 Sep 2022 16:36:33 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <403274.1662041404.1@sss.pgh.pa.us> Date: Thu, 01 Sep 2022 10:10:04 -0400 Message-ID: <403275.1662041404@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Junwang Zhao writes: > result = lappend(result, makeDefElem(pstrdup(s), val, -1)); > + pfree(s); I wonder why it's pstrdup'ing s in the first place. regards, tom lane