Skip to content

Commit

Permalink
Merge pull request #306 from qzhuyan/dev/william/fix-owner-sig-leak
Browse files Browse the repository at this point in the history
fix: owner sig leak if owner crash
  • Loading branch information
qzhuyan authored Oct 10, 2024
2 parents b55b358 + f1f619d commit 5bf02f7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
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_

0 comments on commit 5bf02f7

Please sign in to comment.