Re: Increase repalloc_array() usage in buffile.c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Tristan Partin <tristan(at)partin(dot)io>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Increase repalloc_array() usage in buffile.c
Date: 2026-07-31 02:49:54
Message-ID: amwNUuPWn-XPm9qJ@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 31, 2026 at 08:42:21AM +0900, Michael Paquier wrote:
> The reason why these holes exist is that the patch series of
> 1b105f9472bdb was quite large, so I have been focusing mainly on
> making sure that all the suggested changes were right instead of
> trying to fix all of them. The long term picture is that we should do
> the switch to do more type enforcements, and that this work is
> incremental.
>
> Saying all that, the proposed patch makes sense, and this is
> incremental work, so I am going to apply it.

By the way, just mentioning two of these holes, using the following
command in src/backend/storage/file/:
$ git grep -A 2 "alloc(" | grep sizeof
fd.c: fd = (int *) palloc(size * sizeof(int));
fd.c: fd = (int *) repalloc(fd, size * sizeof(int));

Switched these extra two spots, while on it, and applied the result.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2026-07-31 02:58:40 Re: [PATCH] Rewrite undirected edge patterns in GRAPH_TABLE using UNION ALL
Previous Message Michael Paquier 2026-07-31 02:47:43 Re: COPY TO BLACKHOLE / pg_dump -j -Fb