Always pfree tmp WAL key when allocated

We didn't pfree the key in case of `EncryptXLog == true && key == true`
pull/220/head
Andrew Pogrebnoy 5 months ago committed by Andrew Pogrebnoi
parent 033f7cae77
commit cc459df896
  1. 5
      contrib/pg_tde/src/access/pg_tde_xlog_encrypt.c

@ -206,15 +206,16 @@ TDEXLogSmgrInit(void)
{
pg_tde_create_wal_key(&EncryptionKey, &GLOBAL_SPACE_RLOCATOR(XLOG_TDE_OID),
TDE_KEY_TYPE_WAL_UNENCRYPTED);
pfree(key);
}
else if (key)
{
EncryptionKey = *key;
pg_atomic_write_u64(&EncryptionState->enc_key_lsn, EncryptionKey.start_lsn);
pfree(key);
}
if (key)
pfree(key);
pg_tde_set_db_file_path(GLOBAL_SPACE_RLOCATOR(XLOG_TDE_OID).dbOid, EncryptionState->db_map_path);
#endif

Loading…
Cancel
Save