Skip to content

Commit ca831f0

Browse files
azertyfunNathan Monfils
authored andcommitted
Fix further leak of tdata (pjsip#4878)
The leak happens when 1. send_buf_pending is already in use 2. ssock_on_data_sent calls flush_circ_buf_output 3. send_buf_pending gets overwritten -> previous data in send_buf_pending is lost forever, its callback is never called, and therefore the reference to the tdata it contains is never decremented, preventing transport destruction
1 parent 6102700 commit ca831f0

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pjlib/src/pj/ssl_sock_imp_common.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,9 @@ static pj_status_t flush_circ_buf_output(pj_ssl_sock_t *ssock,
584584

585585
/* Allocate buffer for send data */
586586
wdata = alloc_send_data(ssock, needed_len);
587-
if (wdata == NULL) {
587+
if (wdata == NULL && ssock->send_buf_pending.data_len) {
588+
return PJ_ENOMEM;
589+
} else if (wdata == NULL) {
588590
/* Oops, the send buffer is full, let's just
589591
* queue it for sending and return PJ_EPENDING.
590592
*/

0 commit comments

Comments
 (0)