Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i4pZI-0003JT-1c for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Sep 2019 16:52:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i4pZF-0003IL-TC for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Sep 2019 16:52:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i4pZF-0003A9-EJ for pgsql-bugs@lists.postgresql.org; Mon, 02 Sep 2019 16:52:37 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1i4pZB-0004N4-By for pgsql-bugs@lists.postgresql.org; Mon, 02 Sep 2019 16:52:36 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 8CE3821C1C5E for ; Mon, 2 Sep 2019 19:52:31 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.200] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 5F08B21C08FF for ; Mon, 2 Sep 2019 19:52:30 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1567443151; bh=1jDEDjGJAeyVZlPFWox8PnxJ0a18kr4DDRCXfPLIz8M=; h=To:From:Subject:Date; b=Y7qMj+nyA0ajQxP4GpoDpz8yJEl56Q6DzpPu1PFdcsc/d/ysnyeXGnU5ej8hT6j4D sGAaDFAGzA9pk0ZQuvxO2GKdniLWefqkLYFKC+V2fI8MVpx+057eKq9g56uEQ8XRN1 dovH0RGRwQuEauAPJVJrAzB7CU1Kmd4R3MO5yMm8= To: pgsql-bugs@lists.postgresql.org From: Konstantin Knizhnik Subject: Memory leak in formatting.c Message-ID: <94c0ad0a-cbc2-e4a3-7829-2bdeaf9146db@postgrespro.ru> Date: Mon, 2 Sep 2019 19:52:30 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------37FDAC2C7031C06F05574FB7" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------37FDAC2C7031C06F05574FB7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Memory leak in formatting.c in case of using ICU. Proposed trivial fix is attached. -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --------------37FDAC2C7031C06F05574FB7 Content-Type: text/x-patch; name="formatting.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="formatting.patch" diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index b3115e4..755ca6e 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1584,6 +1584,7 @@ str_tolower(const char *buff, size_t nbytes, Oid collid) &buff_conv, buff_uchar, len_uchar); icu_from_uchar(&result, buff_conv, len_conv); pfree(buff_uchar); + pfree(buff_conv); } else #endif @@ -1707,6 +1708,7 @@ str_toupper(const char *buff, size_t nbytes, Oid collid) &buff_conv, buff_uchar, len_uchar); icu_from_uchar(&result, buff_conv, len_conv); pfree(buff_uchar); + pfree(buff_conv); } else #endif @@ -1831,6 +1833,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid) &buff_conv, buff_uchar, len_uchar); icu_from_uchar(&result, buff_conv, len_conv); pfree(buff_uchar); + pfree(buff_conv); } else #endif --------------37FDAC2C7031C06F05574FB7--