diff options
| author | QXSoftware <lh563566994@126.com> | 2018-10-03 13:42:24 +0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-10-02 23:25:45 -0700 |
| commit | 6c334f30cccaa9ddae81ee0865621b6695fb7e3a (patch) | |
| tree | dc097744f8dbc0c6a539bf43910089f157a479c6 /src/core | |
| parent | b1a59eb620cb735feba284db9acc64dfe0b35415 (diff) | |
| download | nng-6c334f30cccaa9ddae81ee0865621b6695fb7e3a.tar.gz nng-6c334f30cccaa9ddae81ee0865621b6695fb7e3a.tar.bz2 nng-6c334f30cccaa9ddae81ee0865621b6695fb7e3a.zip | |
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
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/message.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |
