Skip to content

Commit

Permalink
Avoid release of store if there have been later allocations. Bug 2199
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Harris committed Nov 25, 2017
1 parent ef9da2e commit 4e6ae62
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/src/receive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 4e6ae62

Please sign in to comment.