Remove unneeded allocations for HTTP messages.

This commit is contained in:
Jon Siwek 2014-09-15 13:38:52 -05:00
parent a87b22cd0a
commit a7373a1ca4
3 changed files with 9 additions and 2 deletions

View file

@ -1,4 +1,8 @@
2.3-172 | 2014-09-15 13:38:52 -0500
* Remove unneeded allocations for HTTP messages. (Jon Siwek)
2.3-171 | 2014-09-15 11:14:57 -0500 2.3-171 | 2014-09-15 11:14:57 -0500
* Fix a compile error on systems without pcap-int.h. (Jon Siwek) * Fix a compile error on systems without pcap-int.h. (Jon Siwek)

View file

@ -1 +1 @@
2.3-171 2.3-172

View file

@ -545,7 +545,7 @@ HTTP_Message::HTTP_Message(HTTP_Analyzer* arg_analyzer,
current_entity = 0; current_entity = 0;
top_level = new HTTP_Entity(this, 0, expect_body); top_level = new HTTP_Entity(this, 0, expect_body);
entity_data_buffer = new char[http_entity_data_delivery_size]; entity_data_buffer = 0;
BeginEntity(top_level); BeginEntity(top_level);
start_time = network_time; start_time = network_time;
@ -718,6 +718,9 @@ void HTTP_Message::SubmitData(int len, const char* buf)
int HTTP_Message::RequestBuffer(int* plen, char** pbuf) int HTTP_Message::RequestBuffer(int* plen, char** pbuf)
{ {
if ( ! entity_data_buffer )
entity_data_buffer = new char[http_entity_data_delivery_size];
*plen = http_entity_data_delivery_size; *plen = http_entity_data_delivery_size;
*pbuf = entity_data_buffer; *pbuf = entity_data_buffer;
return 1; return 1;