BUG/MINOR: stick-table: handle out-of-memory condition gracefully
In case `pool_alloc2()` returns NULL, propagate the condition to the
caller. This could happen when limiting the amount of memory available
for HAProxy with `-m`.
[wt: backport to 1.6 and 1.5 needed]
(cherry picked from commit ef8f4fe12d03d6e015b6e5bfa0a9d063cff83b89)
(cherry picked from commit 797c48a454fa1a7181b6b11cf93b38dd6c2a62b0)
diff --git a/src/stick_table.c b/src/stick_table.c
index 6310690..c77b402 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -167,9 +167,10 @@
return NULL;
}
- ts = pool_alloc2(t->pool) + t->data_size;
+ ts = pool_alloc2(t->pool);
if (ts) {
t->current++;
+ ts += t->data_size;
stksess_init(t, ts);
if (key)
stksess_setkey(t, ts, key);