Fix: fd leak in process client msg error path
authorDavid Goulet <dgoulet@efficios.com>
Tue, 14 May 2013 16:41:49 +0000 (12:41 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 15 May 2013 14:21:07 +0000 (10:21 -0400)
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 <dgoulet@efficios.com>
src/bin/lttng-sessiond/main.c

index 2cb8f5a23e77b267b37dc513d5dccb8bdc994c40..c3f8ab3bdbc7dfb8aff2c5eca9b146276c6ac22d 100644 (file)
@@ -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
This page took 0.027584 seconds and 4 git commands to generate.