From: David Goulet Date: Tue, 14 May 2013 16:41:49 +0000 (-0400) Subject: Fix: fd leak in process client msg error path X-Git-Tag: v2.2.0-rc3~70 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=36134aa184c8ed8f67a197d66d1310425abbf1ce;p=lttng-tools.git 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 --- 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