ソースを参照

Release buffers after ms_respose_header_send is called.

This should not be required, since the caller has to free the buffer also
if mg_response_header_send is not called. Still this makes the code easier
to read in the success case. There are some additional free calls required
for the error cases.
bel2125 2 年 前
コミット
c6a212dcdf
1 ファイル変更3 行追加0 行削除
  1. 3 0
      src/response.inl

+ 3 - 0
src/response.inl

@@ -296,12 +296,14 @@ mg_response_header_send(struct mg_connection *conn)
 #if defined(USE_HTTP2)
 	if (conn->protocol_type == PROTOCOL_TYPE_HTTP2) {
 		int ret = http2_send_response_headers(conn);
+		free_buffered_response_header_list(conn);
 		return (ret ? 0 : -4);
 	}
 #endif
 
 	/* Send */
 	if (!send_http1_response_status_line(conn)) {
+		free_buffered_response_header_list(conn);
 		return -4;
 	};
 	for (i = 0; i < conn->response_info.num_headers; i++) {
@@ -335,5 +337,6 @@ mg_response_header_send(struct mg_connection *conn)
 	conn->request_state = 3;
 
 	/* ok */
+	free_buffered_response_header_list(conn);
 	return 0;
 }