summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/pgp-decrypt.c
diff options
context:
space:
mode:
authorMichael Paquier2020-09-25 01:25:55 +0000
committerMichael Paquier2020-09-25 01:25:55 +0000
commitca7f8e2b86e5f15a40b67e6199d714f45a467ff1 (patch)
tree19c94a35cb8ff4902d4b4f7b477ace69e1d34a33 /contrib/pgcrypto/pgp-decrypt.c
parenta45bc8a4f6495072bc48ad40a5aa0304979114f7 (diff)
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-decrypt.c')
-rw-r--r--contrib/pgcrypto/pgp-decrypt.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/contrib/pgcrypto/pgp-decrypt.c b/contrib/pgcrypto/pgp-decrypt.c
index 3ecbf9c0c25..d12dcad1945 100644
--- a/contrib/pgcrypto/pgp-decrypt.c
+++ b/contrib/pgcrypto/pgp-decrypt.c
@@ -211,7 +211,7 @@ pktreader_free(void *priv)
struct PktData *pkt = priv;
px_memset(pkt, 0, sizeof(*pkt));
- px_free(pkt);
+ pfree(pkt);
}
static struct PullFilterOps pktreader_filter = {
@@ -224,13 +224,13 @@ pgp_create_pkt_reader(PullFilter **pf_p, PullFilter *src, int len,
int pkttype, PGP_Context *ctx)
{
int res;
- struct PktData *pkt = px_alloc(sizeof(*pkt));
+ struct PktData *pkt = palloc(sizeof(*pkt));
pkt->type = pkttype;
pkt->len = len;
res = pullf_create(pf_p, &pktreader_filter, pkt, src);
if (res < 0)
- px_free(pkt);
+ pfree(pkt);
return res;
}
@@ -447,8 +447,7 @@ mdcbuf_init(void **priv_p, void *arg, PullFilter *src)
PGP_Context *ctx = arg;
struct MDCBufData *st;
- st = px_alloc(sizeof(*st));
- memset(st, 0, sizeof(*st));
+ st = palloc0(sizeof(*st));
st->buflen = sizeof(st->buf);
st->ctx = ctx;
*priv_p = st;
@@ -576,7 +575,7 @@ mdcbuf_free(void *priv)
px_md_free(st->ctx->mdc_ctx);
st->ctx->mdc_ctx = NULL;
px_memset(st, 0, sizeof(*st));
- px_free(st);
+ pfree(st);
}
static struct PullFilterOps mdcbuf_filter = {