diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2017-11-24 20:22:33 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2017-11-25 15:49:32 +0000 |
commit | 4e6ae6235c68de243b1c2419027472d7659aa2b4 (patch) | |
tree | 7196616ebcb380947cbe531e21e09b68771d4590 | |
parent | ef9da2ee969c27824fcd5aed6a59ac4cd217587b (diff) |
Avoid release of store if there have been later allocations. Bug 2199
-rw-r--r-- | src/src/receive.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/src/receive.c b/src/src/receive.c index e7e518a92..d9b500102 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -1810,8 +1810,8 @@ for (;;) (and sometimes lunatic messages can have ones that are 100s of K long) we call store_release() for strings that have been copied - if the string is at the start of a block (and therefore the only thing in it, because we aren't - doing any other gets), the block gets freed. We can only do this because we - know there are no other calls to store_get() going on. */ + doing any other gets), the block gets freed. We can only do this release if + there were no allocations since the once that we want to free. */ if (ptr >= header_size - 4) { @@ -1820,9 +1820,10 @@ for (;;) header_size *= 2; if (!store_extend(next->text, oldsize, header_size)) { + BOOL release_ok = store_last_get[store_pool] == next->text; uschar *newtext = store_get(header_size); memcpy(newtext, next->text, ptr); - store_release(next->text); + if (release_ok) store_release(next->text); next->text = newtext; } } |