Re: using worker_spi as pattern - Mailing list pgsql-hackers

From Jeremy Finzel
Subject Re: using worker_spi as pattern
Date
Msg-id CAMa1XUhGWykBEs+566_XcyeZd93S=0+Kc5nsg0C6+jE=_VBbtg@mail.gmail.com
Whole thread Raw
In response to Re: using worker_spi as pattern  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Fri, Mar 9, 2018 at 12:34 AM, Michael Paquier <michael@paquier.xyz> wrote:
On Thu, Mar 08, 2018 at 11:04:20PM -0600, Jeremy Finzel wrote:
> Since you mention, can anyone elaborate further on the memory leak danger
> here?
>
> Line 193 in src/test/modules/worker_spi/worker_spi.c read:
> # Note some memory might be leaked here.
>
> Is this any reason *not *to use this pattern in production?

quote_identifier may palloc the result, so the first pstrdup on the top
to save "schema" and "table" refer to a pointer which may perhaps get
lost.  Those are just a couple of bytes, so the code complication is not
worth the cleanup IMO.
--
Michael

Makes sense, thank you.

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: JIT compiling with LLVM v11
Next
From: Alvaro Herrera
Date:
Subject: Re: FOR EACH ROW triggers on partitioned tables