diff --git a/plugins/router_static/router_static.c b/plugins/router_static/router_static.c index 7ea438ad..14c5d8e2 100644 --- a/plugins/router_static/router_static.c +++ b/plugins/router_static/router_static.c @@ -141,7 +141,10 @@ int uwsgi_routing_func_sendfile(struct wsgi_request *wsgi_req, struct uwsgi_rout // static file - don't update avg_rt after request wsgi_req->do_not_account_avg_rt = 1; - if (urfc->no_headers) goto send; + if (urfc->no_headers) { + uwsgi_buffer_destroy(ub_s); + goto send; + } if (uwsgi_response_prepare_headers(wsgi_req, ub_s->buf, ub_s->pos)) { uwsgi_buffer_destroy(ub_s); @@ -211,7 +214,10 @@ int uwsgi_routing_func_fastfile(struct wsgi_request *wsgi_req, struct uwsgi_rout // static file - don't update avg_rt after request wsgi_req->do_not_account_avg_rt = 1; - if (urfc->no_headers) goto send; + if (urfc->no_headers) { + uwsgi_buffer_destroy(ub_s); + goto send; + } if (uwsgi_response_prepare_headers(wsgi_req, ub_s->buf, ub_s->pos)) { uwsgi_buffer_destroy(ub_s);