From bfb81533885f0c2e23f8c1ba5cc1e85de49efa8e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 30 May 2020 14:58:34 -0700 Subject: [PATCH] client: Fix a memory leak in an error path This patch fixes the following Coverity complaint: CID 300985 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_storage: Variable client going out of scope leaks the storage it points to. Signed-off-by: Bart Van Assche --- client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client.c b/client.c index b7575596..7e5ac17d 100644 --- a/client.c +++ b/client.c @@ -471,8 +471,10 @@ int fio_client_add(struct client_ops *ops, const char *hostname, void **cookie) &client->is_sock, &client->port, &client->addr.sin_addr, &client->addr6.sin6_addr, - &client->ipv6)) + &client->ipv6)) { + fio_put_client(client); return -1; + } client->fd = -1; client->ops = ops; -- 2.25.1