BUG/MINOR: spoe: Fix memory leak if failing to allocate memory

Technically harmless, but it annoys clang analyzer.

This bug was introduced in 336d3ef0e77192582c98b3c578927a529ceadd9b.
This fix should be backported to HAProxy 1.9+.
This commit is contained in:
Tim Duesterhus 2019-06-23 22:10:13 +02:00 committed by Christopher Faulet
parent 2c9e274f45
commit b298613072

View File

@ -3751,6 +3751,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
goto out; goto out;
} }
if ((vph->name = strdup(args[cur_arg])) == NULL) { if ((vph->name = strdup(args[cur_arg])) == NULL) {
free(vph);
ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum); ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT; err_code |= ERR_ALERT | ERR_ABORT;
goto out; goto out;