aboutsummaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/pgp-encrypt.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2020-09-25 10:25:55 +0900
committerMichael Paquier <michael@paquier.xyz>2020-09-25 10:25:55 +0900
commitca7f8e2b86e5f15a40b67e6199d714f45a467ff1 (patch)
tree19c94a35cb8ff4902d4b4f7b477ace69e1d34a33 /contrib/pgcrypto/pgp-encrypt.c
parenta45bc8a4f6495072bc48ad40a5aa0304979114f7 (diff)
downloadpostgresql-ca7f8e2b86e5f15a40b67e6199d714f45a467ff1.tar.gz
postgresql-ca7f8e2b86e5f15a40b67e6199d714f45a467ff1.zip
Remove custom memory allocation layer in pgcrypto
PX_OWN_ALLOC was intended as a way to disable the use of palloc(), and over the time new palloc() or equivalent calls have been added like in 32984d8, making this extra layer losing its original purpose. This simplifies on the way some code paths to use palloc0() rather than palloc() followed by memset(0). Author: Daniel Gustafsson Discussion: https://postgr.es/m/A5BFAA1A-B2E8-4CBC-895E-7B1B9475A527@yesql.se
Diffstat (limited to 'contrib/pgcrypto/pgp-encrypt.c')
-rw-r--r--contrib/pgcrypto/pgp-encrypt.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/contrib/pgcrypto/pgp-encrypt.c b/contrib/pgcrypto/pgp-encrypt.c
index 46518942ac2..f7467c9b1cb 100644
--- a/contrib/pgcrypto/pgp-encrypt.c
+++ b/contrib/pgcrypto/pgp-encrypt.c
@@ -178,8 +178,7 @@ encrypt_init(PushFilter *next, void *init_arg, void **priv_p)
if (res < 0)
return res;
- st = px_alloc(sizeof(*st));
- memset(st, 0, sizeof(*st));
+ st = palloc0(sizeof(*st));
st->ciph = ciph;
*priv_p = st;
@@ -219,7 +218,7 @@ encrypt_free(void *priv)
if (st->ciph)
pgp_cfb_free(st->ciph);
px_memset(st, 0, sizeof(*st));
- px_free(st);
+ pfree(st);
}
static const PushFilterOps encrypt_filter = {
@@ -241,7 +240,7 @@ pkt_stream_init(PushFilter *next, void *init_arg, void **priv_p)
{
struct PktStreamStat *st;
- st = px_alloc(sizeof(*st));
+ st = palloc(sizeof(*st));
st->final_done = 0;
st->pkt_block = 1 << STREAM_BLOCK_SHIFT;
*priv_p = st;
@@ -301,7 +300,7 @@ pkt_stream_free(void *priv)
struct PktStreamStat *st = priv;
px_memset(st, 0, sizeof(*st));
- px_free(st);
+ pfree(st);
}
static const PushFilterOps pkt_stream_filter = {