Skip to content

Commit

Permalink
Michelp/fixinitpalloc (#17)
Browse files Browse the repository at this point in the history
* push fix for using palloc in init.

* convert path palloc as well.
  • Loading branch information
michelp authored Jan 21, 2021
1 parent 5c965ea commit f57bd69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pgsodium.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void _PG_init(void)

if (process_shared_preload_libraries_in_progress)
{
path = (char*) palloc(MAXPGPATH);
path = (char*) malloc(MAXPGPATH);
get_share_path(my_exec_path, sharepath);
snprintf(
path,
Expand Down Expand Up @@ -77,7 +77,7 @@ void _PG_init(void)
PG_GETKEY_EXEC);
proc_exit(1);
}
pgsodium_secret_key = palloc(crypto_sign_SECRETKEYBYTES + VARHDRSZ);
pgsodium_secret_key = malloc(crypto_sign_SECRETKEYBYTES + VARHDRSZ);
hex_decode(secret_buf, secret_len, VARDATA(pgsodium_secret_key));
sodium_mlock(pgsodium_secret_key, crypto_sign_SECRETKEYBYTES + VARHDRSZ);
memset(secret_buf, 0, secret_len);
Expand Down

0 comments on commit f57bd69

Please sign in to comment.