Skip to content

Commit 8082bea

Browse files
committed
Fix use-after-free bug
Detected by buildfarm member prion
1 parent 3428ef7 commit 8082bea

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/backend/commands/statscmds.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ CreateStatistics(CreateStatsStmt *stmt)
230230
statoid = HeapTupleGetOid(htup);
231231
heap_freetuple(htup);
232232
heap_close(statrel, RowExclusiveLock);
233+
234+
/*
235+
* Invalidate relcache so that others see the new statistics.
236+
*/
237+
CacheInvalidateRelcache(rel);
238+
233239
relation_close(rel, NoLock);
234240

235241
/*
@@ -250,11 +256,6 @@ CreateStatistics(CreateStatsStmt *stmt)
250256

251257
ObjectAddressSet(address, StatisticExtRelationId, statoid);
252258

253-
/*
254-
* Invalidate relcache so that others see the new statistics.
255-
*/
256-
CacheInvalidateRelcache(rel);
257-
258259
return address;
259260
}
260261

0 commit comments

Comments
 (0)