Re: use the malloc macros in pg_dump.c

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: use the malloc macros in pg_dump.c
Date: 2026-02-02 21:19:47
Message-ID: CAHut+Psstckak1YeL70caxqWDVKNWNvrnYg=0opYT_433xPF5g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 2, 2026 at 11:38 PM Aleksander Alekseev
<aleksander(at)tigerdata(dot)com> wrote:
>
> Hi Peter,
>
> > I found that pg_dump.c has many pg_mallocs where the new object/array
> > macros could have been used, but currently they are not. I'm not sure
> > if this was a deliberate or accidental omission.
> >
> > In case it was accidental, here is a patch to modify/simplify all that
> > allocation code.
>
> Thanks for the patch. I reviewed / tested it and it looks OK. This
> being said, I see many pieces of code left that still use pg_malloc /
> pg_realloc in a similar fashion, including src/bin/pg_dump/* files.
> Would you like to address those as well, or keep the scope only to
> pg_dump.c?
>

Hi Aleksander.

Thanks for your review!

At first I only changed only one file because I was unsure why these
changes were not already made, and whether others thought it was
worthwhile.

Now you have encouraged me that the patch makes sense, so I will
increase the scope to cover all the other pg_dump/* files. Will post
more later.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-02-02 21:46:31 Re: Decoupling our alignment assumptions about int64 and double
Previous Message Nathan Bossart 2026-02-02 20:52:43 Re: getting "shell command argument contains a newline or carriage return:" error with pg_dumpall when db name have new line in double quote