Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: owner sig leak if owner crash #306

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ erl_crash.dump
.concrete/DEV_MODE
.DS_Store
.cache
build

# rebar 2.x
.rebar
Expand All @@ -23,6 +24,7 @@ rebar.lock
priv/*.so
priv/*lttng.*
priv/*.dylib
priv/**

# language server caches
.ccls-cache/
Expand All @@ -36,3 +38,6 @@ compile_commands.json
# downloaded code
msquic/
_packages/

# test logs
asan_logs/
19 changes: 19 additions & 0 deletions c_src/quicer_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ init_s_ctx()
void
deinit_s_ctx(QuicerStreamCTX *s_ctx)
{
cleanup_owner_signals(s_ctx);
enif_mutex_destroy(s_ctx->lock);
enif_free_env(s_ctx->env);
}
Expand Down Expand Up @@ -409,3 +410,21 @@ cache_stream_id(QuicerStreamCTX *s_ctx)
s_ctx->StreamID = UNSET_STREAMID;
}
}

void
cleanup_owner_signals(QuicerStreamCTX *s_ctx)
{
OWNER_SIGNAL *sig;

if (!s_ctx->sig_queue)
{
return;
}
while ((sig = OwnerSignalDequeue(s_ctx->sig_queue)))
{
CxPlatFree(sig, QUICER_OWNER_SIGNAL);
}

OwnerSignalQueueDestroy(s_ctx->sig_queue);
s_ctx->sig_queue = NULL;
}
2 changes: 2 additions & 0 deletions c_src/quicer_ctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,6 @@ BOOLEAN get_reg_handle(QuicerRegistrationCTX *r_ctx);

void cache_stream_id(QuicerStreamCTX *s_ctx);

void cleanup_owner_signals(QuicerStreamCTX *s_ctx);

#endif // __QUICER_CTX_H_
Loading