mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
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
This commit is contained in:
@ -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 = {
|
||||
|
Reference in New Issue
Block a user