mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-12 08:27:24 +00:00
BUG: compression: do not always increment the round counter on allocation failure
Zlib (at least 1.2 and 1.3) aborts when it fails to allocate the state, so we must not count a round on this event. If the state succeeds, then it allocates all the 4 remaining counters at once.
This commit is contained in:
parent
4663577e24
commit
4690985fca
@ -393,7 +393,13 @@ static void *alloc_zlib(void *opaque, unsigned int items, unsigned int size)
|
||||
|
||||
end:
|
||||
|
||||
round = (round + 1) % 5; /* there are 5 zalloc call in deflateInit2 */
|
||||
/* deflateInit2() first allocates and checks the deflate_state, then if
|
||||
* it succeeds, it allocates all other 4 areas at ones and checks them
|
||||
* at the end. So we want to correctly count the rounds depending on when
|
||||
* zlib is supposed to abort.
|
||||
*/
|
||||
if (buf || round)
|
||||
round = (round + 1) % 5;
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user