mirror of https://github.com/citusdata/citus.git
Fix dangling pointer warning in AnyTableReplicated (#6504)
DESCRIPTION: Fixes a potential dangling pointer issue Need to backport to 11.0 & 11.1 since we might want to release packages for debian/bookworm based on those branches in future.pull/6511/head
parent
a477ffdf4b
commit
80faf47ab5
|
@ -781,14 +781,7 @@ SerializeNonCommutativeWrites(List *shardIntervalList, LOCKMODE lockMode)
|
||||||
static bool
|
static bool
|
||||||
AnyTableReplicated(List *shardIntervalList, List **replicatedShardIntervalList)
|
AnyTableReplicated(List *shardIntervalList, List **replicatedShardIntervalList)
|
||||||
{
|
{
|
||||||
if (replicatedShardIntervalList == NULL)
|
|
||||||
{
|
|
||||||
/* the caller is not interested in the replicatedShardIntervalList */
|
|
||||||
List *localList = NIL;
|
List *localList = NIL;
|
||||||
replicatedShardIntervalList = &localList;
|
|
||||||
}
|
|
||||||
|
|
||||||
*replicatedShardIntervalList = NIL;
|
|
||||||
|
|
||||||
ShardInterval *shardInterval = NULL;
|
ShardInterval *shardInterval = NULL;
|
||||||
foreach_ptr(shardInterval, shardIntervalList)
|
foreach_ptr(shardInterval, shardIntervalList)
|
||||||
|
@ -798,17 +791,22 @@ AnyTableReplicated(List *shardIntervalList, List **replicatedShardIntervalList)
|
||||||
Oid relationId = RelationIdForShard(shardId);
|
Oid relationId = RelationIdForShard(shardId);
|
||||||
if (ReferenceTableShardId(shardId))
|
if (ReferenceTableShardId(shardId))
|
||||||
{
|
{
|
||||||
*replicatedShardIntervalList =
|
localList =
|
||||||
lappend(*replicatedShardIntervalList, LoadShardInterval(shardId));
|
lappend(localList, LoadShardInterval(shardId));
|
||||||
}
|
}
|
||||||
else if (!SingleReplicatedTable(relationId))
|
else if (!SingleReplicatedTable(relationId))
|
||||||
{
|
{
|
||||||
*replicatedShardIntervalList =
|
localList =
|
||||||
lappend(*replicatedShardIntervalList, LoadShardInterval(shardId));
|
lappend(localList, LoadShardInterval(shardId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list_length(*replicatedShardIntervalList) > 0;
|
if (replicatedShardIntervalList != NULL)
|
||||||
|
{
|
||||||
|
*replicatedShardIntervalList = localList;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list_length(localList) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue