pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Cc: Alex Kozhemyakin <a.kozhemyakin@postgrespro.ru>
Subject: Re: Bug in DefineRange() with multiranges
Date: Tue, 12 Oct 2021 08:52:29 +0300
Message-ID: <f50a7e90-b166-b41d-3a7d-c0344974446e@postgrespro.ru> (raw)
In-Reply-To: <2d3a3eb1-5a88-da6b-556f-0d7700af52e1@enterprisedb.com>
References: <d5042d46-b9cd-6efb-219a-71ed0cf45bc8@postgrespro.ru>
	<2d3a3eb1-5a88-da6b-556f-0d7700af52e1@enterprisedb.com>

On 10.10.2021 20:12, Peter Eisentraut wrote:
> On 04.10.21 19:09, Sergey Shinderuk wrote:
>> I wonder what is the proper fix.  Just drop pfree() altogether or add
>> pstrdup() instead?  I see that makeMultirangeTypeName() doesn't bother
>> freeing its buf.
> 
> I think removing the pfree()s is a correct fix.
> 

Thanks, here is a patch.


-- 
Sergey Shinderuk		https://postgrespro.com/

Attachments:

0001-Fix-premature-pfree-of-multirange_type_name-in-Defin.patch (text/plain, 991B) download From 6c548f07d2a254da46cd0b6f6e99b7ed24a6b811 Mon Sep 17 00:00:00 2001 From: Sergey Shinderuk <s.shinderuk@postgrespro.ru> Date: Tue, 12 Oct 2021 07:57:42 +0300 Subject: [PATCH] Fix premature pfree() of multirange_type_name in DefineRange() If the mutlirange_type_name parameter is given in the query, this would erroneously pfree() the string in the parse tree. Oversight in 6df7a9698bb0. --- src/backend/commands/typecmds.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index b290629a450..9ab40341793 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -1707,7 +1707,6 @@ DefineRange(ParseState *pstate, CreateRangeStmt *stmt) /* Create cast from the range type to its multirange type */ CastCreate(typoid, multirangeOid, castFuncOid, 'e', 'f', DEPENDENCY_INTERNAL); - pfree(multirangeTypeName); pfree(multirangeArrayName); return address; -- 2.24.3 (Apple Git-128)

view thread (5+ messages)  latest in thread

Message-ID: <f50a7e90-b166-b41d-3a7d-c0344974446e@postgrespro.ru>
Permalink:  ../f50a7e90-b166-b41d-3a7d-c0344974446e@postgrespro.ru/
Also on:    postgresql.org/message-id/f50a7e90-b166-b41d-3a7d-c0344974446e@postgrespro.ru

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: s.shinderuk@postgrespro.ru, peter.eisentraut@enterprisedb.com, a.kozhemyakin@postgrespro.ru
  Subject: Re: Bug in DefineRange() with multiranges
  In-Reply-To: <f50a7e90-b166-b41d-3a7d-c0344974446e@postgrespro.ru>
  References: <d5042d46-b9cd-6efb-219a-71ed0cf45bc8@postgrespro.ru> <2d3a3eb1-5a88-da6b-556f-0d7700af52e1@enterprisedb.com> <f50a7e90-b166-b41d-3a7d-c0344974446e@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox