From: Vincent Bernat Date: Thu, 17 Nov 2016 14:42:40 +0000 (+0100) Subject: BUG/MINOR: stick-table: handle out-of-memory condition gracefully X-Git-Tag: v1.7.0~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef8f4fe;p=thirdparty%2Fhaproxy.git 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] --- diff --git a/src/stick_table.c b/src/stick_table.c index 7a2fcc21af..7026fe6565 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -170,9 +170,10 @@ struct stksess *stksess_new(struct stktable *t, struct stktable_key *key) 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);