Skip to content

Commit

Permalink
Try to appease ASan
Browse files Browse the repository at this point in the history
Signed-off-by: Cole Miller <[email protected]>
  • Loading branch information
cole-miller committed Oct 7, 2024
1 parent 33a4a24 commit 85e494d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/raft/fixture.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,13 @@ static void ioFlushTruncate(struct io *io, struct truncate *r)
for (size_t i = n; i < io->n; i++) {
raft_free(io->entries[i].buf.base);
}
entries = raft_realloc(io->entries, n * sizeof(*io->entries));
if (n == 0) {
raft_free(io->entries);
entries = NULL;
} else {
entries = raft_realloc(io->entries, n * sizeof(*io->entries));
POST(entries != NULL);
}
POST(ERGO(n > 0, entries != NULL));

io->entries = entries;
io->n = n;
Expand Down

0 comments on commit 85e494d

Please sign in to comment.