From 36134aa184c8ed8f67a197d66d1310425abbf1ce Mon Sep 17 00:00:00 2001 From: David Goulet Date: Tue, 14 May 2013 12:41:49 -0400 Subject: [PATCH] Fix: fd leak in process client msg error path The process_client_msg() function could return an error but no sock_error. In any case, we have to close the socket since a TODO is still there indicating that we need to reply to the client to inform of the error. Issue 1019920 of coverity scan. Signed-off-by: David Goulet --- src/bin/lttng-sessiond/main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 2cb8f5a23..c3f8ab3bd 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -3449,13 +3449,11 @@ static void *thread_manage_clients(void *data) ret = process_client_msg(cmd_ctx, sock, &sock_error); rcu_thread_offline(); if (ret < 0) { - if (sock_error) { - ret = close(sock); - if (ret) { - PERROR("close"); - } - sock = -1; + ret = close(sock); + if (ret) { + PERROR("close"); } + sock = -1; /* * TODO: Inform client somehow of the fatal error. At * this point, ret < 0 means that a zmalloc failed -- 2.34.1