mirror of
https://github.com/postgres/postgres.git
synced 2025-10-28 11:55:03 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user