mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-21 23:56:55 +02:00
Fixed memory size caluclation problem.
See https://github.com/msgpack/msgpack-c/issues/149
This commit is contained in:
@@ -179,7 +179,12 @@ int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to)
|
||||
const size_t reqsize = nused + tosize;
|
||||
size_t nnext = (size_t)(to->end - to->array) * 2;
|
||||
while(nnext < reqsize) {
|
||||
nnext *= 2;
|
||||
size_t tmp_nnext = nnext * 2;
|
||||
if (tmp_nnext <= nnext) {
|
||||
nnext = reqsize;
|
||||
break;
|
||||
}
|
||||
nnext = tmp_nnext;
|
||||
}
|
||||
|
||||
struct iovec* nvec = (struct iovec*)realloc(
|
||||
|
Reference in New Issue
Block a user