mirror of
https://github.com/postgres/postgres.git
synced 2026-04-22 14:47:29 -04:00
Fix use-after-free in ri_LoadConstraintInfo
conindid was read from conForm after ReleaseSysCache(tup). Move
the read to before the release.
Introduced by commit 2da86c1ef9.
Per buildfarm member prion.
Discussion: https://postgr.es/m/CA+HiwqGGYjN6F2oL7yAk=hvSs-sj3TPqZ9JC9iyLkCqJadECrw@mail.gmail.com
This commit is contained in:
parent
097ab69d17
commit
68a8601ee9
1 changed files with 5 additions and 4 deletions
|
|
@ -2396,6 +2396,11 @@ ri_LoadConstraintInfo(Oid constraintOid)
|
|||
&riinfo->period_intersect_oper);
|
||||
}
|
||||
|
||||
/* Metadata used by fast path. */
|
||||
riinfo->conindid = conForm->conindid;
|
||||
riinfo->pk_is_partitioned =
|
||||
(get_rel_relkind(riinfo->pk_relid) == RELKIND_PARTITIONED_TABLE);
|
||||
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
/*
|
||||
|
|
@ -2406,10 +2411,6 @@ ri_LoadConstraintInfo(Oid constraintOid)
|
|||
|
||||
riinfo->valid = true;
|
||||
|
||||
riinfo->conindid = conForm->conindid;
|
||||
riinfo->pk_is_partitioned =
|
||||
(get_rel_relkind(riinfo->pk_relid) == RELKIND_PARTITIONED_TABLE);
|
||||
|
||||
riinfo->fpmeta = NULL;
|
||||
|
||||
return riinfo;
|
||||
|
|
|
|||
Loading…
Reference in a new issue