Skip to content

Commit f843317

Browse files
authored
fix: double free in aeron_archive_context_t (#1897)
Calling aeron_archive_context_duplicate on a context where _ctx->owns_idle_strategy == true will result in a context that also attempts to own the idle strategy. This results in a double free when calling aeron_archive_context_close.
1 parent eb7989a commit f843317

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

aeron-archive/src/main/c/client/aeron_archive_context.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ int aeron_archive_context_duplicate(aeron_archive_context_t **dest_p, aeron_arch
259259
return -1;
260260
}
261261

262+
_ctx->owns_idle_strategy = false;
263+
262264
*dest_p = _ctx;
263265

264266
return 0;
@@ -443,6 +445,7 @@ int aeron_archive_context_conclude(aeron_archive_context_t *ctx)
443445
if (ctx->owns_aeron_client && NULL != ctx->aeron)
444446
{
445447
aeron_close(ctx->aeron);
448+
ctx->aeron = NULL;
446449
}
447450

448451
return -1;

0 commit comments

Comments
 (0)