Skip to content

Commit

Permalink
Avoid passing null to memcpy in walproposer (to satisfy sanitizers)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderlaw committed Jan 22, 2025
1 parent c11fdea commit 7e9d7c9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pgxn/neon/walproposer.c
Original file line number Diff line number Diff line change
@@ -1024,7 +1024,8 @@ DetermineEpochStartLsn(WalProposer *wp)
dth = &wp->safekeeper[wp->donor].voteResponse.termHistory;
wp->propTermHistory.n_entries = dth->n_entries + 1;
wp->propTermHistory.entries = palloc(sizeof(TermSwitchEntry) * wp->propTermHistory.n_entries);
memcpy(wp->propTermHistory.entries, dth->entries, sizeof(TermSwitchEntry) * dth->n_entries);
if (dth->n_entries > 0)
memcpy(wp->propTermHistory.entries, dth->entries, sizeof(TermSwitchEntry) * dth->n_entries);
wp->propTermHistory.entries[wp->propTermHistory.n_entries - 1].term = wp->propTerm;
wp->propTermHistory.entries[wp->propTermHistory.n_entries - 1].lsn = wp->propEpochStartLsn;

0 comments on commit 7e9d7c9

Please sign in to comment.