Avoiding a use-after-free error on AE receive
Signed-off-by: Louis Solofrizzo <lsolofrizzo@scaleway.com>
---
raft.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/raft.c b/raft.c
index 8bd9322..90d5e55 100644
--- a/raft.c
+++ b/raft.c
@@ -116,7 +116,6 @@ void libfloat_reload_state(libfloat_ctx_t *ctx)
libfloat_log_memory_cleanup(ctx);
}
- /* XXX some part of code try to load missing log but other not */
for (size_t i = ctx->persistent.snapshot.index + 1; i <= ctx->persistent.commit_index; i++)
{
libfloat_log_entry_t *log;
@@ -131,6 +130,7 @@ void libfloat_reload_state(libfloat_ctx_t *ctx)
iterator = kh_put(libfloat_entry_id_t, ctx->persistent.log, log->id, &absent);
kh_value(ctx->persistent.log, iterator) = log;
+ ctx->last_log = log;
}
}
--
2.37.3