diff options
author | Michael Paquier <michael@paquier.xyz> | 2020-09-25 10:25:55 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2020-09-25 10:25:55 +0900 |
commit | ca7f8e2b86e5f15a40b67e6199d714f45a467ff1 (patch) | |
tree | 19c94a35cb8ff4902d4b4f7b477ace69e1d34a33 /contrib/pgcrypto/openssl.c | |
parent | a45bc8a4f6495072bc48ad40a5aa0304979114f7 (diff) | |
download | postgresql-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/openssl.c')
-rw-r--r-- | contrib/pgcrypto/openssl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/pgcrypto/openssl.c b/contrib/pgcrypto/openssl.c index 3057afb3390..90951a8ae7b 100644 --- a/contrib/pgcrypto/openssl.c +++ b/contrib/pgcrypto/openssl.c @@ -156,7 +156,7 @@ digest_free(PX_MD *h) OSSLDigest *digest = (OSSLDigest *) h->p.ptr; free_openssl_digest(digest); - px_free(h); + pfree(h); } static int px_openssl_initialized = 0; @@ -214,7 +214,7 @@ px_find_digest(const char *name, PX_MD **res) open_digests = digest; /* The PX_MD object is allocated in the current memory context. */ - h = px_alloc(sizeof(*h)); + h = palloc(sizeof(*h)); h->result_size = digest_result_size; h->block_size = digest_block_size; h->reset = digest_reset; @@ -353,7 +353,7 @@ gen_ossl_free(PX_Cipher *c) OSSLCipher *od = (OSSLCipher *) c->ptr; free_openssl_cipher(od); - px_free(c); + pfree(c); } static int @@ -790,7 +790,7 @@ px_find_cipher(const char *name, PX_Cipher **res) od->evp_ciph = i->ciph->cipher_func(); /* The PX_Cipher is allocated in current memory context */ - c = px_alloc(sizeof(*c)); + c = palloc(sizeof(*c)); c->block_size = gen_ossl_block_size; c->key_size = gen_ossl_key_size; c->iv_size = gen_ossl_iv_size; |