curl_schannel.c: Avoid unnecessary realloc calls to reduce buffer size

This commit is contained in:
Marc Hoersken 2012-06-19 14:57:12 +02:00 committed by Daniel Stenberg
parent 64962b0218
commit 7d2abe27dd

View File

@ -886,22 +886,6 @@ schannel_recv(struct connectdata *conn, int sockindex,
connssl->decdata_offset -= size;
}
/* reduce internal buffer length to reduce memory usage */
if(connssl->encdata_length > CURL_SCHANNEL_BUFFER_INIT_SIZE) {
connssl->encdata_length =
connssl->encdata_offset > CURL_SCHANNEL_BUFFER_INIT_SIZE ?
connssl->encdata_offset : CURL_SCHANNEL_BUFFER_INIT_SIZE;
connssl->encdata_buffer = realloc(connssl->encdata_buffer,
connssl->encdata_length);
}
if(connssl->decdata_length > CURL_SCHANNEL_BUFFER_INIT_SIZE) {
connssl->decdata_length =
connssl->decdata_offset > CURL_SCHANNEL_BUFFER_INIT_SIZE ?
connssl->decdata_offset : CURL_SCHANNEL_BUFFER_INIT_SIZE;
connssl->decdata_buffer = realloc(connssl->decdata_buffer,
connssl->decdata_length);
}
/* check if the server closed the connection */
if(ret <= 0 && ( /* special check for Windows 2000 Professional */
sspi_status == SEC_I_CONTEXT_EXPIRED || (sspi_status == SEC_E_OK &&