smgr: Make SMgrRelation initialization safer against errors

Andres Freund <andres@anarazel.de>

Commit: 499faf9063a4c5a9985d7ac657b86e8e34e02199
Author: Andres Freund <andres@anarazel.de>
Date: 2025-03-18T18:04:44Z
Releases: 18.0
smgr: Make SMgrRelation initialization safer against errors

In case the smgr_open callback failed, the ->pincount field would not be
initialized and the relation would not be put onto the unpinned_relns list.

This buglet was introduced in 21d9c3ee4ef7, in 17.

Discussion: https://postgr.es/m/3vae7l5ozvqtxmd7rr7zaeq3qkuipz365u3rtim5t5wdkr6f4g@vkgf2fogjirl
Backpatch-through: 17

Files

PathChange+/−
src/backend/storage/smgr/smgr.c modified +3 −3

Discussion