File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,25 @@ void add_stream(struct tmux_stream *stream) {
67
67
* @param id The ID of the stream to be deleted.
68
68
*/
69
69
void del_stream (uint32_t id ) {
70
- if (!all_stream )
70
+ // Early return if hash table is not initialized
71
+ if (!all_stream ) {
72
+ debug (LOG_DEBUG , "Stream hash table not initialized" );
71
73
return ;
74
+ }
75
+
76
+ // Find stream in hash table
77
+ struct tmux_stream * stream = NULL ;
78
+ HASH_FIND_INT (all_stream , & id , stream );
72
79
73
- struct tmux_stream * stream = get_stream_by_id (id );
74
- if (stream )
75
- HASH_DEL (all_stream , stream ); // no need to free stream, it will be freed
76
- // when proxy client is freed
80
+ // Delete stream if found
81
+ if (stream ) {
82
+ HASH_DEL (all_stream , stream );
83
+ debug (LOG_DEBUG , "Stream %u removed from hash table" , id );
84
+ } else {
85
+ debug (LOG_DEBUG , "Stream %u not found in hash table" , id );
86
+ }
87
+
88
+ // Note: Stream memory is freed when associated proxy client is freed
77
89
}
78
90
79
91
/**
You can’t perform that action at this time.
0 commit comments