Commit 8082bea2 authored by Alvaro Herrera's avatar Alvaro Herrera

Fix use-after-free bug

Detected by buildfarm member prion
parent 3428ef79
......@@ -230,6 +230,12 @@ CreateStatistics(CreateStatsStmt *stmt)
statoid = HeapTupleGetOid(htup);
heap_freetuple(htup);
heap_close(statrel, RowExclusiveLock);
/*
* Invalidate relcache so that others see the new statistics.
*/
CacheInvalidateRelcache(rel);
relation_close(rel, NoLock);
/*
......@@ -250,11 +256,6 @@ CreateStatistics(CreateStatsStmt *stmt)
ObjectAddressSet(address, StatisticExtRelationId, statoid);
/*
* Invalidate relcache so that others see the new statistics.
*/
CacheInvalidateRelcache(rel);
return address;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment