]> git.kaiwu.me - nginx.git/commitdiff
QUIC: fixed memory leak in ngx_quic_send_frames().
authorVladimir Homutov <vl@nginx.com>
Wed, 7 Oct 2020 07:14:02 +0000 (10:14 +0300)
committerVladimir Homutov <vl@nginx.com>
Wed, 7 Oct 2020 07:14:02 +0000 (10:14 +0300)
The function did not free passed frames in case of error.

src/event/ngx_event_quic.c

index c6a249b422f350c7f616be534a2bdd6f7b0ac8e7..aff89b01d9cd22571174bfff810aba7f93d0295f 100644 (file)
@@ -3839,6 +3839,7 @@ ngx_quic_send_frames(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx,
 
         len = ngx_quic_create_frame(p, f);
         if (len == -1) {
+            ngx_quic_free_frames(c, frames);
             return NGX_ERROR;
         }
 
@@ -3897,11 +3898,13 @@ ngx_quic_send_frames(ngx_connection_t *c, ngx_quic_send_ctx_t *ctx,
                    pkt.num_len, pkt.trunc);
 
     if (ngx_quic_encrypt(&pkt, ssl_conn, &res) != NGX_OK) {
+        ngx_quic_free_frames(c, frames);
         return NGX_ERROR;
     }
 
     len = c->send(c, res.data, res.len);
     if (len == NGX_ERROR || (size_t) len != res.len) {
+        ngx_quic_free_frames(c, frames);
         return NGX_ERROR;
     }