gfphoenix78 commented on code in PR #1424:
URL: https://github.com/apache/cloudberry/pull/1424#discussion_r2516546765
##########
src/backend/crypto/bufenc.c:
##########
@@ -47,16 +47,28 @@ InitializeBufferEncryption(void)
if (!FileEncryptionEnabled)
return;
+ /*
+ * To avoid memory leaks, when the postmaster resets the cluster,
+ * need to release the memory which was alloced at last time.
+ */
+ if (BufEncCtx)
+ {
+ free(BufEncCtx);
+ BufEncCtx = NULL;
+ }
+ if (BufDecCtx)
+ {
+ free(BufDecCtx);
+ BufDecCtx = NULL;
+ }
Review Comment:
`free` doesn't match `pg_cipher_ctx_create()`. It's allocated by
`EVP_CIPHER_CTX_new()`. We shouldn't assume it uses malloc/calloc internally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]