Skip to content

Commit cc459df

Browse files
committed
Always pfree tmp WAL key when allocated
We didn't pfree the key in case of `EncryptXLog == true && key == true`
1 parent 033f7ca commit cc459df

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

contrib/pg_tde/src/access/pg_tde_xlog_encrypt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,16 @@ TDEXLogSmgrInit(void)
206206
{
207207
pg_tde_create_wal_key(&EncryptionKey, &GLOBAL_SPACE_RLOCATOR(XLOG_TDE_OID),
208208
TDE_KEY_TYPE_WAL_UNENCRYPTED);
209-
pfree(key);
210209
}
211210
else if (key)
212211
{
213212
EncryptionKey = *key;
214213
pg_atomic_write_u64(&EncryptionState->enc_key_lsn, EncryptionKey.start_lsn);
215-
pfree(key);
216214
}
217215

216+
if (key)
217+
pfree(key);
218+
218219
pg_tde_set_db_file_path(GLOBAL_SPACE_RLOCATOR(XLOG_TDE_OID).dbOid, EncryptionState->db_map_path);
219220

220221
#endif

0 commit comments

Comments
 (0)