From 6c334f30cccaa9ddae81ee0865621b6695fb7e3a Mon Sep 17 00:00:00 2001 From: QXSoftware Date: Wed, 3 Oct 2018 13:42:24 +0800 Subject: fix function "int nni_msg_alloc(nni_msg **mp, size_t sz)" allocates the underlying buffer twice under some circumstance, say, sz = 1024 or 2048 --- src/core/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/message.c') diff --git a/src/core/message.c b/src/core/message.c index f3151230..db302c03 100644 --- a/src/core/message.c +++ b/src/core/message.c @@ -124,7 +124,7 @@ nni_chunk_grow(nni_chunk *ch, size_t newsz, size_t headwanted) if (headwanted < headroom) { headwanted = headroom; // Never shrink this. } - if (((newsz + headwanted) < ch->ch_cap) && + if (((newsz + headwanted) <= ch->ch_cap) && (headwanted <= headroom)) { // We have enough space at the ends already. return (0); -- cgit v1.2.3-70-g09d2