~ne02ptzero/libfloat

d88dcd582e56fb83541a85bb8f6e82d14438548b — Louis Solofrizzo 13 days ago 45936d4
raft: Set last_log when reloading state

Avoiding a use-after-free error on AE receive

Patch         : https://lists.sr.ht/~ne02ptzero/libfloat/patches/35331

Signed-off-by : Louis Solofrizzo <lsolofrizzo@scaleway.com>
Acked-by      : Patrik Cyvoct <pcyvoct@scaleway.com>

 ________________________________________
/ Something must be Done This is         \
| Something Therefore, This must be Done |
\ -- The Thatcherite Syllogism           /
 ----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
1 files changed, 1 insertions(+), 1 deletions(-)

M raft.c
M raft.c => raft.c +1 -1
@@ 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;
    }
}