From: Willy Tarreau Date: Thu, 7 Feb 2019 13:22:52 +0000 (+0100) Subject: BUG/MINOR: spoe: do not assume agent->rt is valid on exit X-Git-Tag: v2.0-dev1~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3ddcf7643cfe5b542d72b0f6f815fc302e8e3bc9;p=thirdparty%2Fhaproxy.git BUG/MINOR: spoe: do not assume agent->rt is valid on exit As reported by Christopher, we may call spoe_release_agent() when leaving after an allocation failure or a config parse error. We must not assume agent->rt is valid there as the allocation could have failed. This should be backported to 1.9 and 1.8. --- diff --git a/src/flt_spoe.c b/src/flt_spoe.c index f9a529f219..9418ff20c7 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -184,8 +184,10 @@ spoe_release_agent(struct spoe_agent *agent) LIST_DEL(&grp->list); spoe_release_group(grp); } - for (i = 0; i < global.nbthread; ++i) - HA_SPIN_DESTROY(&agent->rt[i].lock); + if (agent->rt) { + for (i = 0; i < global.nbthread; ++i) + HA_SPIN_DESTROY(&agent->rt[i].lock); + } free(agent->rt); free(agent); }