Skip to content
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
2 changes: 1 addition & 1 deletion src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ void connection_cleanup(connection_t *c) {
* The function is lightweight and only acts if conditions are met */
buffer_pool_try_shrink();

/* Free service if owned */
/* Free the per-connection service instance */
if (c->service) {
service_free(c->service);
c->service = NULL;
Expand Down
3 changes: 1 addition & 2 deletions src/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,7 @@ int stream_context_cleanup(stream_context_t *ctx) {

/* NOTE: Do NOT free ctx->service here!
* The service pointer is shared with the parent connection (c->service).
* The connection owns the service and will free it in connection_cleanup()
* based on the c->service_owned flag.
* The connection owns the service and will free it in connection_cleanup().
* Freeing it here would cause double-free when connection_cleanup() is called.
*/
ctx->service = NULL; /* Clear pointer but don't free */
Expand Down
3 changes: 2 additions & 1 deletion src/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ int stream_handle_fd_event(stream_context_t *ctx, int fd, uint32_t events, int64
int stream_tick(stream_context_t *ctx, int64_t now);

/**
* Cleanup all resources owned by the stream context and free dynamic service.
* Cleanup all resources owned by the stream context.
* The parent connection owns and frees the service pointer.
* @param ctx Stream context to cleanup
* @return 0 if cleanup completed, 1 if async TEARDOWN in progress (cleanup
* deferred)
Expand Down
Loading