Skip to content

Commit f8210ef

Browse files
authored
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 ```
1 parent 897c057 commit f8210ef

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/bin/pg_upgrade/pg_upgrade.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,7 @@ get_cluster_version(ClusterInfo *cluster)
371371

372372
PQfinish(conn);
373373

374-
stop_postmaster(cluster);
375-
376-
return;
374+
stop_postmaster(false);
377375
}
378376

379377
#ifdef WIN32

0 commit comments

Comments
 (0)