kongfanshen-0801 commented on code in PR #1424:
URL: https://github.com/apache/cloudberry/pull/1424#discussion_r2509408993


##########
src/backend/crypto/bufenc.c:
##########
@@ -51,12 +51,9 @@ InitializeBufferEncryption(void)
 
        if (CheckIsSM4Method())
        {
-               bool found;
-               BufEncCtx = ShmemInitStruct("sm4 encryption method encrypt ctx",
-                                                                               
                sizeof(sm4_ctx), &found);
+               BufEncCtx = malloc(sizeof(sm4_ctx));

Review Comment:
   Cann't use the static memory block。 when enable AES algorithm,  we use 
open_ssl function EVP_CIPHER_CTX_new to alloc memory for BufEncCtx/BufDecCtx. 
The code of alloc memory in third party libraries.
   When the postmaster resets the cluster, free memory if BufEncCtx/BufDecCtx 
is not null. This can avoid memory leaks.



-- 
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]

Reply via email to