Skip to content

Commit

Permalink
fix: leak out-of-order packet if the read callback destroys the stream (
Browse files Browse the repository at this point in the history
  • Loading branch information
jthomas43 authored Oct 5, 2024
1 parent f27b551 commit ad5a271
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/udx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,10 @@ process_packet (udx_socket_t *socket, char *buf, ssize_t buf_len, struct sockadd

if ((pkt->type & UDX_HEADER_DATA) && stream->on_read != NULL) {
stream->on_read(stream, pkt->buf.len, &(pkt->buf));
if (stream->status & UDX_STREAM_DEAD) return 1;
if (stream->status & UDX_STREAM_DEAD) {
free(pkt);
return 1;
}
}

free(pkt);
Expand Down

0 comments on commit ad5a271

Please sign in to comment.