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/pgp-mpi-internal.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/pgp-mpi-internal.c')
-rw-r--r-- | contrib/pgcrypto/pgp-mpi-internal.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/pgcrypto/pgp-mpi-internal.c b/contrib/pgcrypto/pgp-mpi-internal.c index 0cea5141805..5b94e654521 100644 --- a/contrib/pgcrypto/pgp-mpi-internal.c +++ b/contrib/pgcrypto/pgp-mpi-internal.c @@ -60,10 +60,10 @@ mp_px_rand(uint32 bits, mpz_t *res) int last_bits = bits & 7; uint8 *buf; - buf = px_alloc(bytes); + buf = palloc(bytes); if (!pg_strong_random(buf, bytes)) { - px_free(buf); + pfree(buf); return PXE_NO_RANDOM; } @@ -78,7 +78,7 @@ mp_px_rand(uint32 bits, mpz_t *res) mp_int_read_unsigned(res, buf, bytes); - px_free(buf); + pfree(buf); return 0; } |