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

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


The following commit(s) were added to refs/heads/main by this push:
     new f8210ef6812 Fix `stop_postmaster` call in get_cluster_version. (#1497)
f8210ef6812 is described below

commit f8210ef6812387154ff36f99dddfd36dfe0fd7a8
Author: reshke <[email protected]>
AuthorDate: Tue Dec 23 12:32:57 2025 +0500

    Fix `stop_postmaster` call in get_cluster_version. (#1497)
    
    stop_postmaster accepts single boolean arg, yet pointer of type ClusterInfo 
is passed. Remove this, and call stop_postmaster with `false` argument, 
resulting in smart (not fast) shutdown. Also remove redundant return at the end 
on void function.
    Introduced as oversight in e20a488.
    
    
    Fixed with help of coverity report:
    
    
    ```
    ** CID 640088:       Null pointer dereferences  (REVERSE_INULL)
    /src/bin/pg_upgrade/pg_upgrade.c: 374           in get_cluster_version()
    
    
    
_____________________________________________________________________________________________
    *** CID 640088:         Null pointer dereferences  (REVERSE_INULL)
    /src/bin/pg_upgrade/pg_upgrade.c: 374             in get_cluster_version()
    368             cluster->dbid = dbid;
    369
    370             PQclear(res);
    371
    372             PQfinish(conn);
    373
    >>>     CID 640088:         Null pointer dereferences  (REVERSE_INULL)
    >>>     Null-checking "cluster" suggests that it may be null, but it has 
already been dereferenced on all paths leading to the check.
    374             stop_postmaster(cluster);
    375
    376             return;
    377     }
    378
    379     #ifdef WIN32
    
    
    ```
---
 src/bin/pg_upgrade/pg_upgrade.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 054d1b07c29..506666acdf1 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -371,9 +371,7 @@ get_cluster_version(ClusterInfo *cluster)
 
        PQfinish(conn);
 
-       stop_postmaster(cluster);
-
-       return;
+       stop_postmaster(false);
 }
 
 #ifdef WIN32


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to