1
0
mirror of https://github.com/moparisthebest/spdylay synced 2024-08-13 17:03:54 -04:00

Allocate bytes divisible by 4KiB when expanding buffer

This commit is contained in:
Tatsuhiro Tsujikawa 2012-02-16 22:54:08 +09:00
parent 61cfa3b9f8
commit 7a6bf8e5cc

View File

@ -57,6 +57,7 @@ int spdylay_reserve_buffer(uint8_t **buf_ptr, size_t *buflen_ptr,
size_t min_length) size_t min_length)
{ {
if(min_length > *buflen_ptr) { if(min_length > *buflen_ptr) {
min_length = (min_length+4095)/4096*4096;
uint8_t *temp = malloc(min_length); uint8_t *temp = malloc(min_length);
if(temp == NULL) { if(temp == NULL) {
return SPDYLAY_ERR_NOMEM; return SPDYLAY_ERR_NOMEM;