This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 1d010b4e0b22a6ee1c34396ac70cbac59c33c6b1
Author: zhangyue <zhang...@hashdata.cn>
AuthorDate: Fri Aug 29 12:40:09 2025 +0800

    Revert "Fix double free issue in alterResgroupCallback during io_limit 
cleanup"
    
    This reverts commit 65cd966d5a144dfe861d5107ac2db0be0ad18798.
---
 src/backend/commands/resgroupcmds.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/src/backend/commands/resgroupcmds.c 
b/src/backend/commands/resgroupcmds.c
index f6ee4fefc34..5c319e85b11 100644
--- a/src/backend/commands/resgroupcmds.c
+++ b/src/backend/commands/resgroupcmds.c
@@ -1093,23 +1093,10 @@ alterResgroupCallback(XactEvent event, void *arg)
        if (event == XACT_EVENT_COMMIT)
                ResGroupAlterOnCommit(callbackCtx);
 
-       /*
-        * Free io_limit resources allocated in AlterResourceGroup().
-        *
-        * We need to handle two cases:
-        * 1. caps.io_limit != oldCaps.io_limit: case 
RESGROUP_LIMIT_TYPE_IO_LIMIT
-        * 2. caps.io_limit == oldCaps.io_limit: other cases
-        *
-        * The pointer comparison (oldCaps.io_limit != caps.io_limit) is 
crucial to
-        * avoid double free errors. When "other cases", both pointers might
-        * reference the same memory location, so we only free oldCaps.io_limit 
if
-        * it's different from caps.io_limit.
-        */
        if (callbackCtx->caps.io_limit != NIL)
                cgroupOpsRoutine->freeio(callbackCtx->caps.io_limit);
 
-       if (callbackCtx->oldCaps.io_limit != NIL &&
-               callbackCtx->oldCaps.io_limit != callbackCtx->caps.io_limit)
+       if (callbackCtx->caps.io_limit != NIL)
                cgroupOpsRoutine->freeio(callbackCtx->oldCaps.io_limit);
 
        pfree(callbackCtx);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org
For additional commands, e-mail: commits-h...@cloudberry.apache.org

Reply via email to