Skip to content

Commit 43b55ec

Browse files
committed
Fix uninitialized memory bug
Have interested callers of find_inheritance_children set the detached_exist value to false prior to calling it, so that that routine only has to set it true in the rare cases where it is necessary. Don't touch it otherwise. Per buildfarm member thorntail (which reported a UBSan failure here).
1 parent 84f15cc commit 43b55ec

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/backend/catalog/pg_inherits.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ typedef struct SeenRelsEntry
5353
* against possible DROPs of child relations.
5454
*
5555
* If a partition's pg_inherits row is marked "detach pending",
56-
* *detached_exist (if not null) is set true, otherwise it is set false.
56+
* *detached_exist (if not null) is set true.
5757
*
5858
* If omit_detached is true and there is an active snapshot (not the same as
5959
* the catalog snapshot used to scan pg_inherits!) and a pg_inherits tuple
@@ -84,9 +84,6 @@ find_inheritance_children(Oid parentrelId, bool omit_detached,
8484
if (!has_subclass(parentrelId))
8585
return NIL;
8686

87-
if (detached_exist)
88-
*detached_exist = false;
89-
9087
/*
9188
* Scan pg_inherits and build a working array of subclass OIDs.
9289
*/

src/backend/partitioning/partdesc.c

+1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ RelationBuildPartitionDesc(Relation rel, bool omit_detached)
131131
* concurrently, whatever this function returns will be accurate as of
132132
* some well-defined point in time.
133133
*/
134+
detached_exist = false;
134135
inhoids = find_inheritance_children(RelationGetRelid(rel), omit_detached,
135136
NoLock, &detached_exist);
136137
nparts = list_length(inhoids);

0 commit comments

Comments
 (0)