Skip to content

Commit

Permalink
Fixed a bug in test_lockmode_for_conflict
Browse files Browse the repository at this point in the history
In commit 8e65c1b, wrongly extracting offnum from
tuple(without checking null), so we were getting segment fault. Fixed
this.

Patch by Mahendra Singh Thalor, reviewed by Dilip Kumar
  • Loading branch information
MahendraThalor committed Aug 19, 2019
1 parent 5e01ed9 commit 9ab2aa0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/backend/access/zheap/zheapam.c
Original file line number Diff line number Diff line change
Expand Up @@ -3540,11 +3540,14 @@ test_lockmode_for_conflict(Relation rel, Buffer buf, ZHeapTuple zhtup,
if (DoLockModesConflict(HWLOCKMODE_from_locktupmode(old_mode),
HWLOCKMODE_from_locktupmode(required_mode)))
{
OffsetNumber offnum = ItemPointerGetOffsetNumber(&zhtup->t_self);

*needwait = true;
if (subxid)
ZHeapTupleGetSubXid(buf, offnum, urec_ptr, subxid);
{
Assert(zhtup != NULL);
ZHeapTupleGetSubXid(buf,
ItemPointerGetOffsetNumber(&zhtup->t_self),
urec_ptr, subxid);
}
}

/*
Expand Down

0 comments on commit 9ab2aa0

Please sign in to comment.