]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] stick_table: the fix for the memory leak caused a regression
authorWilly Tarreau <w@1wt.eu>
Fri, 18 Jun 2010 07:57:45 +0000 (09:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 18 Jun 2010 07:57:45 +0000 (09:57 +0200)
(cherry picked from commit 61ba936e6858dfcf9964d25870726621d8188fb9)
[ note: the bug was finally not present in 1.5-dev but at least we
  have to reset store_count to be compatible with 1.4 ]

Commit d6e9e3b5e320b957e6c491bd92d91afad30ba638 caused recently created
entries to be removed as soon as they were created, breaking stickiness.
It is not clear whether a use-after-free was possible or not in this case.

This bug was reported by Ben Congleton and narrowed down by HervĂ© Commowick,
both of whom also tested the fix. Thanks to them !

src/session.c

index 262f48629c5532c2da56257af5923959c6888edb..7c1e4761dd2b8c98e929172e1bf749359a1baae6 100644 (file)
@@ -1068,6 +1068,7 @@ int process_store_rules(struct session *s, struct buffer *rep, int an_bit)
                ptr = stktable_data_ptr(s->store[i].table, ts, STKTABLE_DT_SERVER_ID);
                stktable_data_cast(ptr, server_id) = s->srv->puid;
        }
+       s->store_count = 0; /* everything is stored */
 
        rep->analysers &= ~an_bit;
        rep->analyse_exp = TICK_ETERNITY;