From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Plain strdup() in frontend code |
Date: | 2019-04-29 13:35:12 |
Message-ID: | 4fge7Kzv5SzWhkPBTB9wlN6Xpi95hr_u7HBDxwT2JiNNMg6ersKPlFz3qyqwFTmSzGm90BGy9hj4BVc2mWI-WFvJvI38CxrOAdKIk2zdApM=@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Monday, April 29, 2019 3:01 PM, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> On Mon, Apr 29, 2019 at 11:47:27AM +0000, Daniel Gustafsson wrote:
>
> > Reading code I noticed that we in a few rare instances use strdup() in frontend
> > utilities instead of pg_strdup(). Is there a reason for not using pg_strdup()
> > consistently as per the attached patch?
>
> I think that it is good practice to encourage its use, so making
> things more consistent is a good idea. While on it, we could also
> switch psql's do_lo_import() which uses a malloc() to
> pg_malloc_extended() with MCXT_ALLOC_NO_OOM. GetPrivilegesToDelete()
> in pg_ctl also has an instance of malloc() with a similar failure
> mode.
Good point, I've updated the patch to include those as well.
cheers ./daniel
Attachment | Content-Type | Size |
---|---|---|
frontend_strdup-v2.patch | application/octet-stream | 4.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2019-04-29 13:40:26 | Typofixes in src/bin |
Previous Message | Anastasia Lubennikova | 2019-04-29 13:16:22 | Re: Failure in contrib test _int on loach |