mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +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:
@ -67,8 +67,7 @@ pgp_cfb_create(PGP_CFB **ctx_p, int algo, const uint8 *key, int key_len,
|
||||
return res;
|
||||
}
|
||||
|
||||
ctx = px_alloc(sizeof(*ctx));
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
ctx = palloc0(sizeof(*ctx));
|
||||
ctx->ciph = ciph;
|
||||
ctx->block_size = px_cipher_block_size(ciph);
|
||||
ctx->resync = resync;
|
||||
@ -85,7 +84,7 @@ pgp_cfb_free(PGP_CFB *ctx)
|
||||
{
|
||||
px_cipher_free(ctx->ciph);
|
||||
px_memset(ctx, 0, sizeof(*ctx));
|
||||
px_free(ctx);
|
||||
pfree(ctx);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user