mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +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:
@ -44,7 +44,7 @@ pgp_mpi_alloc(int bits, PGP_MPI **mpi)
|
||||
px_debug("pgp_mpi_alloc: unreasonable request: bits=%d", bits);
|
||||
return PXE_PGP_CORRUPT_DATA;
|
||||
}
|
||||
n = px_alloc(sizeof(*n) + len);
|
||||
n = palloc(sizeof(*n) + len);
|
||||
n->bits = bits;
|
||||
n->bytes = len;
|
||||
n->data = (uint8 *) (n) + sizeof(*n);
|
||||
@ -72,7 +72,7 @@ pgp_mpi_free(PGP_MPI *mpi)
|
||||
if (mpi == NULL)
|
||||
return 0;
|
||||
px_memset(mpi, 0, sizeof(*mpi) + mpi->bytes);
|
||||
px_free(mpi);
|
||||
pfree(mpi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user