Re: pg_malloc0() instead of pg_malloc()+memset() - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: pg_malloc0() instead of pg_malloc()+memset()
Date
Msg-id 20190326080012.GT2558@paquier.xyz
Whole thread Raw
In response to pg_malloc0() instead of pg_malloc()+memset()  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: pg_malloc0() instead of pg_malloc()+memset()
List pgsql-hackers
On Mon, Mar 25, 2019 at 01:18:05PM +0000, Daniel Gustafsson wrote:
> When reading another codepath, I happened to notice a few codepaths where we do
> pg_malloc() immediately followed by a memset( ..  0, ..), without there being a
> justification (that I can see) for not using pg_malloc0() instead. The attached
> patch changes to pg_malloc0(), and passes make check.

If we simplify all of them (and that's not really a big deal), I have
spotted two extra places on top of what you noticed, one in gist.c
where ROTATEDIST is defined and a second one in tablefunc.c.

Thoughts?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Konstantin Knizhnik
Date:
Subject: Re: libpq compression
Next
From: Michael Paquier
Date:
Subject: Re: [Patch] pg_rewind: options to use restore_command fromrecovery.conf or command line