public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chao Li <[email protected]>
To: Postgres hackers <[email protected]>
Subject: Re: Trivial Fix: use palloc_array/repalloc_array for BufFile file arrays
Date: Thu, 25 Dec 2025 11:34:48 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEoWx2m1Vo97Jg9=K7JAZ0xdkg5D=GkgOxZR1=EW7mUfy008fw@mail.gmail.com>
References: <CAEoWx2m1Vo97Jg9=K7JAZ0xdkg5D=GkgOxZR1=EW7mUfy008fw@mail.gmail.com>



> On Dec 25, 2025, at 11:12, Chao Li <[email protected]> wrote:
> 
> Hi Hackers,
> 
> I noticed this error while working on [1].
> 
> In BufFile, the fields is claimed as an array:
> ```
> struct BufFile
> {
>     File *files; /* palloc'd array with numFiles entries */
> ```
> 
> However, it’s allocated by palloc_object():
> ```
> file->files = palloc_object(File);
> ```
> 
> And reallocated by repalloc():
> ```
>     file->files = (File *) repalloc(file->files,
>         (file->numFiles + 1) * sizeof(File));
> ```
> 
> This trivial patch just changes to use palloc_array/repalloc_array, which makes the intent clearer.
> 
> Best regards,
> --
> Chao Li (Evan)
> HighGo Software Co., Ltd.
> https://www.highgo.com/
> 
> 
> 
> 
> <v1-0001-Use-palloc_array-repalloc_array-for-BufFile-file-.patch>


Sorry for missing the reference of [1]:

[1] https://postgr.es/m/[email protected]

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/









view thread (5+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Trivial Fix: use palloc_array/repalloc_array for BufFile file arrays
  In-Reply-To: <[email protected]>

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

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