BUG/MINOR: connections: Make sure we free the connection on failure.
authorOlivier Houchard <cognet@ci0.org>
Fri, 20 Mar 2020 13:26:32 +0000 (14:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Mar 2020 14:52:58 +0000 (16:52 +0200)
commitb82d6ef70bb0a757631549cdc889f9b138da5f09
treee0d16467ac49a6238f6eb58e489e71f9739a12e9
parent635c9a85464dacacae6ac20d4b8082288f7fbbd1
BUG/MINOR: connections: Make sure we free the connection on failure.

In connect_server(), make sure we properly free a newly created connection
if we somehow fail, and it has not yet been attached to a conn_stream, or
it would lead to a memory leak.
This should appease coverity for backend.c, as reported in inssue #556.

This should be backported to 2.1, 2.0 and 1.9

(cherry picked from commit c0caac2cc8f51c5802f0128a4ceb0c73ff601ead)
[wt: minor ctx adjustment]
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/backend.c